select *from t_com_dept_info;
select *from t_com_dept_info where find_in_set(dept_id, getChildLst_DEPT('DEP33603856-a4df-48e2-8eef-ef255ba80417'));
CREATE DEFINER=`gk`@`%` FUNCTION `getChildLst_Org`(
`rootId` VARCHAR(4000)
) RETURNS varchar(4000) CHARSET utf8mb4
BEGIN
DECLARE stemp VARCHAR(4000);
DECLARE stempChd VARCHAR(4000);
SET stempChd = '';
if rootId is null or rootId = '' then set stempChd = '-';
else set stempChd = rootId;
end if;
SET stemp = '';
SET stemp = concat(stemp,',',stempChd);
WHILE stempChd is not null DO
SET stemp = concat(stemp,',',stempChd);
SELECT GROUP_CONCAT(t.organ_id) INTO stempChd FROM t_com_organ_info t where FIND_IN_SET(nvl(t.parent_id,'-'),stempChd)>0;
END WHILE;
RETURN stemp;
END
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。