SELECT TYPEID AS TYPEID, pTYPEID AS 父TYPEID, levels AS 父到子之间级数, concat(paths, ',', TYPEID) AS 父到子路径, pathsName FROM ( SELECT TYPEID, pTYPEID, @le := IF(pTYPEID = 0, 0, IF(LOCATE(CONCAT('|', pTYPEID, ':'), @pathlevel) > 0, SUBSTRING_INDEX(SUBSTRING_IN