Browse Source

用户数据导出

3254194295 2 years ago
parent
commit
ab36e37648
1 changed files with 25 additions and 0 deletions
  1. 25 0
      platform-dao/src/main/resources/mapper/upms/SysUserMapper.xml

+ 25 - 0
platform-dao/src/main/resources/mapper/upms/SysUserMapper.xml

@@ -165,6 +165,31 @@
         ON user.`user_id`=ud.user_id
         LEFT JOIN t_sys_dept dept
         ON ud.`dept_id`=dept.`dept_id`
+        where 1=1
+        <if test="keyword !=null and keyword !=''">
+            and (user.username like CONCAT('%',#{keyword},'%')
+            or user.real_name like CONCAT('%',#{keyword},'%'))
+        </if>
+        <if test="deptId !=null and deptId !=''">
+            and exists (select 1 from t_sys_user_dept ud where ud.user_id = user.user_id and ud.dept_id = #{deptId}
+            union select 1 from t_sys_dept dept where ud.dept_id = #{deptId} and ud.parent_id = '0')
+        </if>
+        <if test="phone !=null and phone !=''">
+            and user.phone = #{phone}
+        </if>
+        <if test="username !=null and username !=''">
+            and user.username = #{username}
+        </if>
+        <if test="teamId !=null and teamId !=''">
+            and exists (select 1 from t_sys_user_team t where t.user_id = user.user_id and t.team_id = #{teamId})
+        </if>
+        <if test="identityType !=null">
+            and user.identity_type = #{identityType}
+        </if>
+        <if test="roleId!=null and roleId!=''">
+            and role.role_id=#{roleId}
+        </if>
         GROUP BY user.`user_id`
+        order by user.update_time desc
     </select>
 </mapper>