医院废弃物信息化管理平台
“mitao”
2026-04-21 2f18b3a28054c3917010f95ba84f7425280a2622
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?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="cn.besteam.modules.system.mapper.SysUserMapper">
 
    <select id="getSysUserList" resultType="cn.besteam.modules.system.dto.SysUserRespListDTO">
        select
        su.id,
        su.name,
        su.account,
        su.phone,
        su.status,
        sud.department_id ,
        su.create_time
        from
        sys_user su
        left JOIN sys_user_department sud on sud.user_id = su.id
        inner join sys_user_role sur on sur.user_id = su.id
        inner join sys_role sr on sr.id = sur.role_id
        where su.admin = 0 and su.del_flag = 0
        <if test="keyword != null and keyword != '' ">
            and
            (
                su.name like CONCAT('%', #{keyword}, '%')
                OR su.account like CONCAT('%', #{keyword}, '%')
                OR su.phone like CONCAT('%', #{keyword}, '%')
            )
        </if>
        <if test="roleName != null and roleName != ''">
            and sr.role_name like CONCAT('%', #{roleName}, '%')
        </if>
        <if test="sysDepartmentIdSet != null and sysDepartmentIdSet.size > 0">
            and sud.department_id in
            <foreach item="departmentId" index="index" collection="sysDepartmentIdSet" open="(" separator="," close=")">
                #{departmentId}
            </foreach>
        </if>
 
        <if test="roleTypeList != null and roleTypeList.size > 0">
            and sr.type in
            <foreach item="roleType" index="index" collection="roleTypeList" open="(" separator="," close=")">
                #{roleType}
            </foreach>
        </if>
        order by su.create_time desc,su.id desc
    </select>
 
    <select id="getAllSysUserList" resultType="cn.besteam.modules.system.dto.SysUserRespListDTO">
        select
        su.id,
        su.name,
        su.account,
        su.phone,
        su.status,
        sud.department_id ,
        su.create_time
        from
        sys_user su
        left join sys_user_department sud on sud.user_id = su.id
        inner join sys_user_role sur on sur.user_id = su.id
        inner join sys_role sr on sr.id = sur.role_id
        where su.admin = 0 and su.del_flag = 0
        <if test="sysDepartmentIdSet != null and sysDepartmentIdSet.size > 0">
            and sud.department_id in
            <foreach item="departmentId" index="index" collection="sysDepartmentIdSet" open="(" separator="," close=")">
                #{departmentId}
            </foreach>
        </if>
        <if test="roleTypeList != null and roleTypeList.size > 0">
            and sr.type in
            <foreach item="roleType" index="index" collection="roleTypeList" open="(" separator="," close=")">
                #{roleType}
            </foreach>
        </if>
        order by su.create_time desc
    </select>
 
 
 
    <select id="getOfficeUserList" resultType="cn.besteam.modules.system.vo.SysUserVO">
        select
          su.id,
          su.name,
          su.phone,
          d.depart_name departmentName
        from
          sys_user su
          inner join sys_user_department sud on sud.user_id = su.id
          inner join sys_department  d on d.id = sud.department_id
        where d.id = #{officeId}
        and su.status = 1
        and su.del_flag = 0
        and su.admin = 0
    </select>
 
    <select id="getDepartmentUserList" resultType="cn.besteam.modules.system.vo.SysUserExportVO">
        select
          su.id,
          su.name,
          su.phone ,
          su.code ,
          d.id departmentId ,
          d.depart_name departmentName
        from
          sys_user su
          inner join sys_user_department sud on sud.user_id = su.id
          inner join sys_department  d on d.id = sud.department_id
        where su.status = 1
        and su.del_flag = 0
        and su.admin = 0
        <if test="departmentIdList !=null and  departmentIdList.size > 0">
            and d.id in
            <foreach collection="departmentIdList" item="departmentId" separator="," open="(" close=")">
                #{departmentId}
            </foreach>
        </if>
    </select>
 
    <select id="getUserList" resultType="cn.besteam.modules.system.vo.SysUserVO">
        select
          su.id,
          concat(su.name , "(" , d.depart_name ,")") name,
          su.phone,
          d.id departmentId ,
          d.depart_name departmentName
        from
          sys_user su
          inner join sys_user_department sud on sud.user_id = su.id
          inner join sys_department  d on d.id = sud.department_id
        where
            su.status = 1
            and su.del_flag = 0
            and su.admin = 0
            <if test="departmentIdList.size > 0">
                and d.id in
                <foreach collection="departmentIdList" item="tempId" separator="," close=")" open="(">
                    #{tempId}
                </foreach>
            </if>
            order by d.tree_code asc
    </select>
 
</mapper>