mysql 查看叶子节点
select dept_id, dept_name as name , parent_id as pid, case when exists( select 1 from sys_dept t2 where a.dept_id = t2.parent_id) then 0 else 1 end as leaf from sys_dept a
此博客主要用于记录相关知识点,大部分内容来自网络文章,特此感谢各位作者
select dept_id, dept_name as name , parent_id as pid, case when exists( select 1 from sys_dept t2 where a.dept_id = t2.parent_id) then 0 else 1 end as leaf from sys_dept a