From 3c901b2289729b8d13689a52faaffb3cd1124594 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期四, 27 三月 2025 13:25:08 +0800 Subject: [PATCH] 修改标准库查询bug --- ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 51bc9b4..ce30170 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -23,6 +23,11 @@ <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> <result property="remark" column="remark" /> + <result property="nameEn" column="name_en" /> + <result property="signatureUrl" column="signature_url" /> + <result property="pictureUrl" column="picture_url" /> + <result property="company" column="company" /> + <result property="roleName" column="role_name" /> <association property="dept" javaType="SysDept" resultMap="deptResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> </resultMap> @@ -47,24 +52,47 @@ </resultMap> <sql id="selectUserVo"> - select u.id, u.dept_id, u.account, u.name, u.email, u.avatar, u.phone, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.id, u.dept_id, u.account, u.name, u.email, u.picture_url, u.phone, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.name_en, u.signature_url, u.company, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from user u left join sys_dept d on u.dept_id = d.dept_id - left join user_role ur on u.id = ur.user_id + left join sys_user_role ur on u.id = ur.user_id left join sys_role r on r.role_id = ur.role_id </sql> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> - select u.id, u.dept_id, u.name, u.account, u.email, u.avatar, u.phone, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from user u + select u.id, + u.dept_id, + u.name, + u.account, + u.email, + u.picture_url, + u.phone, + u.sex, + u.status, + u.del_flag, + u.login_ip, + u.login_date, + u.create_by, + u.create_time, + u.remark, + d.dept_name, + d.leader, + GROUP_CONCAT(DISTINCT sr.role_name SEPARATOR ',') AS role_name + from user u left join sys_dept d on u.dept_id = d.dept_id + left join sys_user_role sur on sur.user_id = u.id + left join sys_role sr on sr.role_id = sur.role_id where u.del_flag = '0' <if test="userId != null and userId != 0"> AND u.id = #{userId} </if> <if test="userName != null and userName != ''"> AND u.account like concat('%', #{userName}, '%') + </if> + <if test="nickName != null and nickName != ''"> + AND u.name like concat('%', #{nickName}, '%') </if> <if test="status != null and status != ''"> AND u.status = #{status} @@ -81,6 +109,7 @@ <if test="deptId != null and deptId != 0"> AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) </if> + group by u.id <!-- 鏁版嵁鑼冨洿杩囨护 --> ${params.dataScope} </select> @@ -89,7 +118,7 @@ select distinct u.id, u.dept_id, u.account, u.name, u.email, u.phone, u.status, u.create_time from user u left join sys_dept d on u.dept_id = d.dept_id - left join user_role ur on u.id = ur.user_id + left join sys_user_role ur on u.id = ur.user_id left join sys_role r on r.role_id = ur.role_id where u.del_flag = '0' and r.role_id = #{roleId} <if test="userName != null and userName != ''"> @@ -106,10 +135,10 @@ select distinct u.id, u.dept_id, u.account, u.name, u.email, u.phone, u.status, u.create_time from user u left join sys_dept d on u.dept_id = d.dept_id - left join user_role ur on u.id = ur.user_id + left join sys_user_role ur on u.id = ur.user_id left join sys_role r on r.role_id = ur.role_id where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL) - and u.id not in (select u.id from user u inner join user_role ur on u.id = ur.user_id and ur.role_id = #{roleId}) + and u.id not in (select u.id from user u inner join sys_user_role ur on u.id = ur.user_id and ur.role_id = #{roleId}) <if test="userName != null and userName != ''"> AND u.account like concat('%', #{userName}, '%') </if> @@ -156,6 +185,9 @@ <if test="status != null and status != ''">status,</if> <if test="createBy != null and createBy != ''">create_by,</if> <if test="remark != null and remark != ''">remark,</if> + <if test="nameEn != null and nameEn != ''">name_en,</if> + <if test="signatureUrl != null and signatureUrl != ''">signature_url,</if> + <if test="company != null and company != ''">company,</if> create_time )values( <if test="userId != null and userId != ''">#{userId},</if> @@ -170,6 +202,9 @@ <if test="status != null and status != ''">#{status},</if> <if test="createBy != null and createBy != ''">#{createBy},</if> <if test="remark != null and remark != ''">#{remark},</if> + <if test="nameEn != null and nameEn != ''">#{nameEn},</if> + <if test="signatureUrl != null and signatureUrl != ''">#{signatureUrl},</if> + <if test="company != null and company != ''">#{company},</if> sysdate() ) </insert> @@ -190,6 +225,10 @@ <if test="loginDate != null">login_date = #{loginDate},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="remark != null">remark = #{remark},</if> + <if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if> + <if test="signatureUrl != null and signatureUrl != ''">signature_url = #{signatureUrl},</if> + <if test="pictureUrl != null and pictureUrl != ''">picture_url = #{pictureUrl},</if> + <if test="company != null and company != ''">company = #{company},</if> update_time = sysdate() </set> where id = #{userId} -- Gitblit v1.9.3