select * from (
select t1.depart_id,
if(find_in_set(t1.parent_id, @pids) > 0, @pids := concat(@pids, ',', t1.depart_id), 0) as ischild
from (
select t.depart_id, t.parent_id from cm_department t where t.is_del = '0' order by t.depart_id, t.parent_id
) t1,
(select @pids := 1777) t2
) t3 where ischild != 0;
查询父部门下的所有子部门(不包括父部门)
最新推荐文章于 2024-06-26 00:40:40 发布