rk
2025-09-28 2304d7b140c5c5b4bf3a83f9ced8bff37d20c42e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.doumee.dao.system.SystemUserMapper">
 
  <!-- 查询用户列表 -->
  <resultMap id="SystemUserListVO" type="com.doumee.dao.system.vo.SystemUserListVO" autoMapping="true">
    <id column="ID" property="id"/>
    <association property="createUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
      <result column="CREATE_USER_ID" property="id"/>
      <result column="CREATE_USER_NAME" property="username"/>
    </association>
    <association property="updateUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
      <result column="UPDATE_USER_ID" property="id"/>
      <result column="UPDATE_USER_NAME" property="username"/>
    </association>
  </resultMap>
  <select id="selectManageList" parameterType="com.doumee.dao.system.dto.QuerySystemUserDTO" resultMap="SystemUserListVO">
    SELECT
      DISTINCT
      usr.ID, usr.BIRTHDAY, usr.EMAIL, usr.EMP_NO, usr.MOBILE, usr.AVATAR, usr.USERNAME, usr.REALNAME, usr.SEX, usr.FIXED, usr.CREATE_TIME, usr.UPDATE_TIME,
      create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME,
      update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME
    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
    <where>
      usr.DELETED = 0
      <if test="dto.username != null and dto.username != ''">
        AND usr.`USERNAME` LIKE CONCAT('%', #{dto.username}, '%')
      </if>
      <if test="dto.realname != null and dto.realname != ''">
        AND usr.`REALNAME` LIKE CONCAT('%', #{dto.realname}, '%')
      </if>
      <if test="dto.mobile != null and dto.mobile != ''">
        AND usr.`MOBILE` LIKE CONCAT('%', #{dto.mobile}, '%')
      </if>
    </where>
    ${orderByClause}
  </select>
 
</mapper>