lyh
2025-06-16 24e0bdd24a10449c98013cdb5bcc5e37735f5a91
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml
@@ -122,12 +122,14 @@
        , comp.description
        , comp.create_time
        , comp.update_time
        , comp.update_user
        , comp.create_user
        , comp.update_by
        , comp.create_by
        , (select sys_user.realname from sys_user where comp.create_by=sys_user.username) as createName
        , (select sys_user.realname from sys_user where comp.update_by=sys_user.username) as updateName
        from nc_component_info comp
        inner join
        (select distinct component_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
        on comp.component_id=s.component_id
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on comp.component_id = s.business_id and s.business_type='2'
        where delete_flag = 0
    </select>
@@ -156,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>