select * from system_organization where id = 1 union all select * from system_organization where id in ( select t3.id from ( select t1.id, if(find_in_set(t1.parent_id, @pids) > 0, @pids := concat(@pids, ‘,‘, t1.id), 0) as ischild from ( select id,parent_id from system_organization t where t.status = 1 ) t1,
-- @pids := 1 这里就是赋值 需要查询的父节点id为1的 及其子组织的id (select @pids := 1 id) t2 ) t3 where t3.ischild != 0 ) order by id