SQL查询树的所有叶子节点
select *
from direction
where (select count(1) from direction e where e.direction_parent_cd=direction.direction_cd) = 0
select *
from direction
where (select count(1) from direction e where e.direction_parent_cd=direction.direction_cd) = 0