From 3cf5e9483f60c94d29df1a79bc0c1ca910ca46ef Mon Sep 17 00:00:00 2001 From: wl <173@qq.com> Date: 星期二, 13 十二月 2022 14:58:24 +0800 Subject: [PATCH] fix: 执法事件对外接口 --- ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml | 97 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 88 insertions(+), 9 deletions(-) diff --git a/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml b/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml index ebc2f28..e2b5f47 100644 --- a/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml +++ b/ycl-common/src/main/resources/mapper/depart/UmsDepartMapper.xml @@ -4,15 +4,94 @@ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> <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"/> + </collection> </resultMap> + <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 + </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.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> </mapper> -- Gitblit v1.8.0