Mysql根据当前组织ID查询其下所有子组织ID
select id from (select t1.id,t1.name,if(find_in_set(parent_id, @pids) > 0,@pids:= concat(@pids, ',', id),0) as ischild from (select id,parent_id,name from tableA t order by parent_id,id ) t1,(select @pids:= 参数值) t2 ) t3 where ischild != 0
注:如果识别不了:=符号导致运行报错,在:=前面加两个斜杠(\\:=)