From 704e7207d74b6477c5f472c5aba92d484ab17f98 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期三, 29 十一月 2023 17:07:11 +0800 Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server --- ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml | 102 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 84 insertions(+), 18 deletions(-) diff --git a/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml b/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml index b8ec297..de105cc 100644 --- a/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml +++ b/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml @@ -4,31 +4,97 @@ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> <resultMap id="BaseResultMap" type="com.ycl.entity.depart.UmsDepart"> - <id column="id" property="id" /> - <result column="depart_name" property="departName" /> - <result column="depart_des" property="departDes" /> - <result column="depart_type" property="departType" /> - <result column="parent_id" property="parentId" /> - <result column="status" property="status" /> - <result column="create_time" property="createTime" /> - <result column="update_time" property="updateTime" /> - <result column="is_deleted" property="isDeleted" /> + <id column="id" property="id"/> + <result column="depart_name" property="departName"/> + <result column="depart_des" property="departDes"/> + <result column="depart_type" property="departType"/> + <result column="parent_id" property="parentId"/> + <result column="status" property="status"/> + <result column="create_time" property="createTime"/> + <result column="update_time" property="updateTime"/> + <result column="is_deleted" property="isDeleted"/> </resultMap> <resultMap type="com.ycl.entity.depart.UmsDepart" id="UserDepartResultMap" extends="BaseResultMap"> <collection property="userInfoDTOS" javaType="ArrayList" ofType="com.ycl.dto.user.DepartUserDTO"> - <id column="user_id" property="userId" /> - <result column="username" property="username" /> + <id column="user_id" property="userId"/> + <result column="username" property="username"/> </collection> </resultMap> - <select id="selectDepartList" resultMap="UserDepartResultMap"> - SELECT - ud.*,ua.id user_id,ua.username - FROM - ums_depart ud - LEFT JOIN ums_depart_manager udm ON ud.id = udm.depart_id - LEFT JOIN ums_admin ua ON udm.user_id = ua.id + <resultMap id="DepartVOMap" type="com.ycl.vo.depart.UmsDepartVO" extends="BaseResultMap"> + <result column="depart_type_name" property="departTypeName" jdbcType="VARCHAR"></result> + <result column="p_depart_name" property="parentDepartName" jdbcType="VARCHAR"></result> + <collection property="userInfoDTOS" javaType="ArrayList" ofType="com.ycl.dto.user.DepartUserDTO"> + <id column="user_id" property="userId"/> + <result column="username" property="username"/> + <result column="is_leader" property="leader" jdbcType="BOOLEAN"></result> + </collection> + </resultMap> + + <select id="selectDepartList" resultMap="UserDepartResultMap"> + SELECT ud.*, + ua.id user_id, + ua.username + FROM ums_depart ud + LEFT JOIN ums_depart_manager udm ON ud.id = udm.depart_id + LEFT JOIN ums_admin ua ON udm.user_id = ua.id + where ud.is_deleted = 0 and ud.status=1 + </select> + <select id="selectPageByName" resultMap="DepartVOMap"> + SELECT t_0.*, + ua.id user_id, + ua.username, + dd.`name` as depart_type_name,udm.is_leader,pd.depart_name as p_depart_name + FROM ( + SELECT ud.* + FROM ums_depart ud + WHERE is_deleted = 0 + <if test="departName!=null and departName!=''"> + and ud.depart_name like CONCAT('%',#{departName},'%') + </if> + ORDER BY ud.parent_id,ud.id desc + LIMIT #{offset}, #{size} + ) t_0 + LEFT JOIN ums_depart_manager udm ON t_0.id = udm.depart_id + LEFT JOIN ums_admin ua ON udm.user_id = ua.id + left join ums_data_dictionary as dd on t_0.depart_type = dd.id + left join ums_depart as pd on t_0.parent_id = pd.id </select> + <select id="selectSurplusUser" resultType="com.ycl.entity.user.UmsAdmin"> + SELECT + t.id, + t3.username + FROM + ( SELECT t1.id FROM ums_admin t1 UNION ALL SELECT t2.user_id FROM ums_depart_manager t2 ) t + LEFT JOIN ums_admin t3 on t3.id =t.id + GROUP BY + id + HAVING + count( * )= 1 + </select> + <select id="selectSurplusUserAndExistUser" resultType="com.ycl.entity.user.UmsAdmin" parameterType="java.lang.Long"> + SELECT + t4.id, + t4.username + FROM + ums_depart_manager t3 + LEFT JOIN ums_admin t4 ON t3.user_id = t4.id + WHERE + t3.depart_id = #{id} UNION ALL + SELECT + t.id, + t3.username + FROM + ( SELECT t1.id FROM ums_admin t1 UNION ALL SELECT t2.user_id FROM ums_depart_manager t2 ) t + LEFT JOIN ums_admin t3 ON t3.id = t.id + GROUP BY + id + HAVING + count( * )= 1 + </select> + <select id="getDepartType" resultType="java.lang.String"> + select name from ums_data_dictionary where id = #{id} + </select> </mapper> -- Gitblit v1.8.0