zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
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
42
43
44
45
46
<?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="org.jeecg.modules.system.mapper.SysUserDepartMapper">
    <select id="getUserDepartByUid" parameterType="String" resultType="org.jeecg.modules.system.entity.SysUserDepart">
        SELECT *
        FROM sys_user_depart
        WHERE user_id = #{userId, jdbcType=VARCHAR}
    </select>
 
    <!-- 查询指定部门下的用户 并且支持用户账号模糊查询 -->
    <select id="queryDepartUserList" resultType="org.jeecg.modules.system.entity.SysUser">
        select a.* from sys_user a
        join sys_user_depart b on b.user_id = a.id
        join sys_depart c on b.dep_id = c.id
        where a.del_flag = 0 and c.org_code like '${orgCode}%'
        <if test="realname!=null and realname!=''">
            and a.realname like '%${realname}%'
        </if>
    </select>
 
    <!-- 根据部门查询部门用户 分页 -->
    <select id="queryDepartUserPageList" resultType="org.jeecg.modules.system.entity.SysUser">
        select a.*, c.depart_name as org_code_txt from sys_user a
        join sys_user_depart b on b.user_id = a.id
        join sys_depart c on b.dep_id = c.id
        where a.del_flag = 0 and c.org_code like '${orgCode}%'
        <if test="username!=null and username!=''">
            and a.username like '%${username}%'
        </if>
        <if test="realname!=null and realname!=''">
            and a.realname like '%${realname}%'
        </if>
    </select>
 
 
    <select id="queryDepUserList" resultType="org.jeecg.modules.system.model.DepartUserModel">
        select a.id,a.username,a.realname, c.id departId, c.depart_name departName ,c.org_code orgCode,c.org_type orgType from sys_user a
        join sys_user_depart b on b.user_id = a.id join sys_depart c on b.dep_id = c.id where 1 =1
        <if test="username!=null and username!=''">
            and a.username like '%${username}%'
        </if>
        <if test="realname!=null and realname!=''">
            and a.realname like '%${realname}%'
        </if>
    </select>
</mapper>