huang
2025-10-30 a99650cb00bf5b0650c33f39a4221b765201d228
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
<?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.mes.userinfo.mapper.SysUserMapper">
 
    <resultMap id="baseMap" type="com.mes.userinfo.entity.vo.SysUserVO">
        <result column="id" property="id"/>
        <result column="user_name" property="userName"/>
        <result column="nick_name" property="nickName"/>
        <result column="password" property="password"/>
        <result column="avatar" property="avatar"/>
        <collection property="roleList" ofType="com.mes.role.SysRole">
            <id column="id" property="id"/>
            <result column="name" property="name"/>
            <result column="state" property="state"/>
            <result column="role_key" property="roleKey"/>
            <result column="state" property="state"/>
            <result column="del_flag" property="delFlag"/>
            <result column="width" property="remark"/>
        </collection>
    </resultMap>
 
 
    <select id="userList" resultMap="baseMap">
        SELECT t.*, t2.*
        FROM sys_user t
        LEFT JOIN sys_user_role t1 ON t.id = t1.user_id
        LEFT JOIN sys_role t2 ON t1.role_id = t2.id
        WHERE 1=1
        <if test="key != null and key != ''">
            and t.user_name LIKE CONCAT('%', #{key}, '%')
        </if>
    </select>
</mapper>