From b693c55ed17cc94efb45ea595341d443bfd4259d Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期六, 23 十一月 2024 09:19:04 +0800 Subject: [PATCH] git ch --- server/service/src/main/resources/mappers/SystemUserMapper.xml | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/server/service/src/main/resources/mappers/SystemUserMapper.xml b/server/service/src/main/resources/mappers/SystemUserMapper.xml index 19dbaa8..9a631fc 100644 --- a/server/service/src/main/resources/mappers/SystemUserMapper.xml +++ b/server/service/src/main/resources/mappers/SystemUserMapper.xml @@ -5,10 +5,6 @@ <!-- 鏌ヨ鐢ㄦ埛鍒楄〃 --> <resultMap id="SystemUserListVO" type="com.doumee.dao.system.vo.SystemUserListVO" autoMapping="true"> <id column="ID" property="id"/> - <association property="department" javaType="com.doumee.dao.system.model.SystemDepartment"> - <result column="DEPARTMENT_ID" property="id"/> - <result column="DEPARTMENT_NAME" property="name"/> - </association> <association property="createUserInfo" javaType="com.doumee.dao.system.model.SystemUser"> <result column="CREATE_USER_ID" property="id"/> <result column="CREATE_USER_NAME" property="username"/> @@ -22,23 +18,27 @@ SELECT DISTINCT usr.*, - sd.ID AS DEPARTMENT_ID, sd.`NAME` AS DEPARTMENT_NAME, + case when cd.HEAD_ID = usr.ID then 1 else 0 end headStatus , + cd.ID AS companyDepartmentId, cd.`NAME_PATH` AS companyDepartmentPathName, cd.`ID_PATH` AS companyDepartmentPathId, create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME, - update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME + update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME, + c.NAME as companyName, + ( select count(1) from company_permission cp where cp.USER_ID = usr.id and cp.TYPE = 1 and cp.ISDELETED = 0 ) as authNum, + case when c.USERNAME = usr.USERNAME then 1 else 0 end isAdmin FROM `SYSTEM_USER` usr LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = usr.CREATE_USER LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = usr.UPDATE_USER LEFT JOIN `SYSTEM_POSITION_USER` spu ON spu.USER_ID = usr.ID AND spu.DELETED = 0 - LEFT JOIN `SYSTEM_POSITION` sp ON sp.ID = spu.POSITION_ID AND sp.DELETED = 0 - LEFT JOIN `SYSTEM_DEPARTMENT_USER` sdu ON sdu.USER_ID = usr.ID AND sdu.DELETED = 0 - LEFT JOIN `SYSTEM_DEPARTMENT` sd ON sd.ID = sdu.DEPARTMENT_ID AND sd.DELETED = 0 + LEFT JOIN Company c ON usr.COMPANY_ID = c.id + LEFT JOIN company_department cd ON usr.DEPARTMENT_ID = cd.id <where> usr.DELETED = 0 + <if test="dto.companyDepartmentId != null"> + AND FIND_IN_SET(#{dto.companyDepartmentId},REPLACE(cd.ID_PATH,'/',',')) + </if> + <if test="dto.positionId != null"> AND spu.POSITION_ID = #{dto.positionId} - </if> - <if test="dto.strictDeptId != null"> - AND sdu.DEPARTMENT_ID = #{dto.strictDeptId} </if> <if test="dto.type != null"> AND usr.TYPE = #{dto.type} @@ -49,14 +49,12 @@ <if test="dto.keyword != null and dto.keyword != ''"> AND ( usr.`USERNAME` LIKE CONCAT('%', #{dto.keyword}, '%') or usr.`REALNAME` LIKE CONCAT('%', #{dto.keyword}, '%') ) </if> + + <if test="dto.companyDepartmentPathName != null and dto.companyDepartmentPathName != ''"> + AND ( cd.`NAME_PATH` LIKE CONCAT('%', #{dto.companyDepartmentPathName}, '%') ) + </if> <if test="dto.companyId != null"> AND usr.COMPANY_ID = #{dto.companyId} - </if> - <if test="dto.departmentIds != null and dto.departmentIds.size > 0"> - AND sdu.DEPARTMENT_ID IN - <foreach collection="dto.departmentIds" open="(" close=")" separator="," item="id"> - #{id} - </foreach> </if> <if test="dto.username != null and dto.username != ''"> AND usr.`USERNAME` LIKE CONCAT('%', #{dto.username}, '%') @@ -64,6 +62,10 @@ <if test="dto.realname != null and dto.realname != ''"> AND usr.`REALNAME` LIKE CONCAT('%', #{dto.realname}, '%') </if> + <if test="dto.companyName != null and dto.companyName != ''"> + AND c.`NAME` LIKE CONCAT('%', #{dto.companyName}, '%') + </if> + <if test="dto.mobile != null and dto.mobile != ''"> AND usr.`MOBILE` LIKE CONCAT('%', #{dto.mobile}, '%') </if> -- Gitblit v1.9.3