https://blog.csdn.net/qq_35206261/article/details/82107127
SELECT
t3.id
FROM (
SELECT
t1.id, t1.parent_id,
t2.*,
IF(FIND_IN_SET(t1.parent_id, @pids) > 0, @pids := CONCAT(@pids, ',', t1.id), 0) AS isChild
FROM (
SELECT id, parent_id FROM sys_role WHERE state > 0 ORDER BY parent_id, id
) AS t1,
( SELECT @pids := 此处修改为要查询的ID ) AS t2
) t3
WHERE t3.isChild != 0