¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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ãmybatisèªå¨å¼å¯é©¼å³°æ è¯è½¬æ¢ menu_name èªå¨è½¬ä¸ºmenuName |
| | | 2ãå®ä½ç±»å¦æä¸ºæ©å±ç±»åï¼éè¦å å
¥idæ ç¾ æ è¯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> |