﻿-- 查询指定 code 的记录及其父项
SELECT *
FROM Dictionary
WHERE code = 'BusinessModule'

UNION

-- 查询指定 code 的记录及其子项
SELECT t.*
FROM Dictionary t
INNER JOIN (
    SELECT Id
    FROM Dictionary
    WHERE code = 'BusinessModule'
) AS selected ON t.ParentId = selected.Id;
