lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml
@@ -158,4 +158,26 @@ on comp.component_id=s.component_id where delete_flag = 0 and parent_id=#{parentId} </select> <select id="findComponentHierarchy" resultType="org.jeecg.modules.dnc.entity.ComponentInfo"> WITH component_tree AS ( SELECT *, 0 AS LEVEL FROM nc_component_info WHERE component_id = #{componentId} UNION ALL SELECT c.*, ct.level + 1 FROM nc_component_info c INNER JOIN component_tree ct ON c.component_id = ct.parent_id ) SELECT * FROM component_tree ORDER BY LEVEL ASC </select> </mapper>