From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 25 六月 2025 11:51:38 +0800 Subject: [PATCH] Merge branch 'mdc_hyjs_master' --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml | 183 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 183 insertions(+), 0 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml new file mode 100644 index 0000000..5d51485 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ComponentInfoMapper"> + + <!-- + 1銆乵ybatis鑷姩寮�鍚┘宄版爣璇嗚浆鎹� menu_name 鑷姩杞负menuName + 2銆佸疄浣撶被濡傛灉涓烘墿灞曠被鍨嬶紝闇�瑕佸姞鍏d鏍囩 鏍囪瘑id瀛楁绫� 涓嶇劧id瀵瑰簲鐨勫瓧娈垫棤娉曡祴鍊� + 3銆佸绾у叧鑱旇鍙ユ槸鍒嗗紑鏌ヨ鐨� 鏁版嵁閲忓ぇ鐨勬儏鍐典笅鎬ц兘浣庝笅 + 4銆佸鏋滅‘瀹氱骇鏍� 鍙互浣跨敤绾ц仈鏌ヨ涓�娆℃煡璇� 渚嬪瓙锛� + --> + <resultMap id="componentExtBaseMap" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <collection column="component_id" property="children" select="findByParentId"> + </collection> + </resultMap> + + <resultMap id="componentExtPermsMap" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <result column="user_id" property="userId" /> + <association property="parent" column="{id=parent_id}" select="findById"> + </association> + <collection column="{parentId=component_id, userId=user_id}" property="children" + javaType="ArrayList" ofType="org.jeecg.modules.dnc.dto.ComponentExt" select="getByParentIdAndUserPerms"> + <id column="component_id" property="componentId" /> + <result column="user_id" property="userId" /> + </collection> + </resultMap> + + <resultMap id="componentExtPermsMapAs" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <association property="parent" column="{id=parent_id}" select="findById"> + </association> + </resultMap> + + <select id="findExtAll" resultMap="componentExtBaseMap"> + select component_id + , parent_id + , product_id + , component_name + , materiel_code + , materiel_desp + , component_model + , component_scale + , component_weight + , rank_level + , assemble_type + , produce_type + , process_type + , structure_type + , component_code + , component_status + , description + from nc_component_info + where rank_level=1 and delete_flag = 0 + </select> + + <select id="findByParentId" resultMap="componentExtBaseMap"> + select component_id + , parent_id + , product_id + , component_name + , materiel_code + , materiel_desp + , component_model + , component_scale + , component_weight + , rank_level + , assemble_type + , produce_type + , process_type + , structure_type + , component_code + , component_status + , description + from nc_component_info + where delete_flag = 0 and parent_id=#{parentId} + </select> + + <select id="getByUserPerms" resultMap="componentExtPermsMap" parameterType="String"> + 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 + , s.user_id + from nc_component_info comp + inner join + (select distinct component_id, user_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.component_id=s.component_id + where rank_level=1 and delete_flag = 0 + </select> + + <select id="getByUserPermsAs" resultMap="componentExtPermsMapAs" parameterType="String"> + 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 + , comp.create_time + , comp.update_time + , 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 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> + + <select id="getByParentIdAndUserPerms" resultMap="componentExtPermsMap" parameterType="java.util.Map"> + 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 + , s.user_id + from nc_component_info comp + inner join + (select distinct component_id, user_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + 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> -- Gitblit v1.9.3