From 7f70cb15d035f0c233b9e62b9e43aa985317c908 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 04 十一月 2024 10:22:45 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/resources/mapper/system/UserMapper.xml |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/zy-acs-manager/src/main/resources/mapper/system/UserMapper.xml b/zy-acs-manager/src/main/resources/mapper/system/UserMapper.xml
index 3928459..6970f2e 100644
--- a/zy-acs-manager/src/main/resources/mapper/system/UserMapper.xml
+++ b/zy-acs-manager/src/main/resources/mapper/system/UserMapper.xml
@@ -18,19 +18,39 @@
         su.*
         from sys_user su
         left join sys_dept sd on su.dept_id = sd.id
+        left join (
+            select *
+            from sys_user_role sur
+            group by sur.user_id
+        ) sur on sur.user_id = su.id
         where 1=1
         and su.deleted = 0
+
         <if test="param.deptId != null">
             and (FIND_IN_SET(#{param.deptId}, sd.`path`) OR sd.`id` = #{param.deptId})
         </if>
+
+        <if test="param.roleIds != null and param.roleIds.size > 0">
+            and sur.role_id in
+            <foreach collection="param.roleIds" item="item" index="idx"  separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+
         <if test="param.username != null">
             and su.username like concat('%',#{param.username},'%')
         </if>
         <if test="param.nickname != null">
             and su.nickname like concat('%',#{param.nickname},'%')
         </if>
+        <if test="param.code != null">
+            and su.code like concat('%',#{param.code},'%')
+        </if>
         <if test="param.phone != null">
             and su.phone like concat('%',#{param.phone},'%')
+        </if>
+        <if test="param.email != null">
+            and su.email like concat('%',#{param.email},'%')
         </if>
         <if test="param.sex != null">
             and su.sex = #{param.sex}
@@ -38,14 +58,35 @@
         <if test="param.status != null">
             and su.status = #{param.status}
         </if>
+        <if test="param.realName != null">
+            and su.real_name like concat('%',#{param.realName},'%')
+        </if>
+        <if test="param.idCard != null">
+            and su.id_card like concat('%',#{param.idCard},'%')
+        </if>
+        <if test="param.memo != null">
+            and su.memo = like concat('%',#{param.memo},'%')
+        </if>
         <if test="param.condition != null">
             and (
                    su.username like concat('%',#{param.condition},'%')
                 or su.nickname like concat('%',#{param.condition},'%')
                 or su.phone like concat('%',#{param.condition},'%')
+                or su.code like concat('%',#{param.condition},'%')
+                or su.email like concat('%',#{param.condition},'%')
+                or su.real_name like concat('%',#{param.condition},'%')
+                or su.id_card like concat('%',#{param.condition},'%')
             )
         </if>
-        order by su.create_time
+        <if test="param.timeStart != null">
+            and su.create_time >= #{param.timeStart}
+        </if>
+        <if test="param.timeEnd != null">
+            and su.create_time &lt; #{param.timeEnd}
+        </if>
+        <if test="param.orderBy != null and param.orderBy != '' ">
+            order by su.${param.orderBy}
+        </if>
     </select>
 
 </mapper>

--
Gitblit v1.9.1