mysql-函数
BEGIN
DECLARE sTemp LONGTEXT;
DECLARE sTempChd VARCHAR(4000);
SET sTemp = NULL;
SET sTempChd =cast(rootId as CHAR);
SET sTemp = sTempChd;
WHILE sTempChd is not null DO
SELECT group_concat(group_id) INTO sTempChd FROM sys_group
where FIND_IN_SET(parent_id,sTempChd)>0 and (is_delete is null or is_delete = '0');
if sTempChd is not null and sTempChd<>'' then
SET sTemp = concat(sTemp,',',sTempChd);
end if;
END WHILE;
RETURN sTemp;
END