递归查询
select code from ( select t1.code, if(find_in_set(parent_code, @pids) > 0, @pids := concat(@pids, ',', `code`), 0) as ischild from (select `code`,parent_code from tbl_dept t order by code) t1, (select @pids := #{code}) t2 ) t3 where ischild!='0'