cuijian
2025-06-16 ec1bf4658e36a17f971a54007920a44c5378b7dc
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>