lyh
2025-06-16 24e0bdd24a10449c98013cdb5bcc5e37735f5a91
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml
@@ -158,27 +158,26 @@
        on comp.component_id=s.component_id
        where delete_flag = 0 and parent_id=#{parentId}
    </select>
    <select id="findById" parameterType="Map" resultMap="componentExtPermsMapAs">
        select comp.component_id
        , comp.parent_id
        , comp.product_id
        , comp.component_name
        , comp.materiel_code
        , comp.materiel_desp
        , comp.component_model
        , comp.component_scale
        , comp.component_weight
        , comp.rank_level
        , comp.assemble_type
        , comp.produce_type
        , comp.process_type
        , comp.structure_type
        , comp.component_code
        , comp.component_status
        , comp.description
        from nc_component_info comp
        where comp.component_id=#{id} and comp.delete_flag=0
    <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>