SQL Server查找一棵树
WITH ModuleInfo AS(
select * from Base_Module where Code='HRAdmin'
UNION ALL
select a.* from Base_Module AS a,ModuleInfo AS b WHERE a.parentid = b.id and a.Enabled=1 and a.DeletionStateCode=0
)
SELECT * FROM ModuleInfo
order by SortCode