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
| <?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.ruoyi.system.mapper.UserMapper">
|
| <!--根据条件获取用户列表-->
| <select id="selectUserCondition" resultType="com.ruoyi.common.core.domain.entity.User">
| select * from (select id,
| dept_id,
| account,
| name,
| name_en,
| user_type,
| email,
| phone,
| sex,
| age,
| signature_url,
| picture_url,
| status,
| del_flag,
| login_ip,
| login_date,
| depart_lims_id,
| company,
| is_custom
| from user
| where del_flag = '0'
| and id != 1) a
| <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
| ${ew.customSqlSegment}
| </if>
| </select>
|
| <!-- 获取用户部门 -->
| <select id="selectUserDepartmentLimsName" resultType="java.lang.String">
| select dl.name
| from user u
| left join department_lims dl on find_in_set(dl.id, u.depart_lims_id) and dl.id != 1
| where u.id = #{userId}
| limit 1
| </select>
|
| <!-- 查询用户和部门 -->
| <select id="selectNameAnddepartment" resultType="java.util.Map">
| select u.name userName,
| dl.name department
| from user u
| left join department_lims dl on find_in_set(dl.id, u.depart_lims_id) and dl.id != 1
| where find_in_set(u.id, #{participant})
| </select>
|
| <!-- 获取当前登录用户信息 -->
| <select id="getUserNow" resultType="com.ruoyi.system.domain.vo.UserVo">
| select u.id,
| c.company,
| u.name,
| c.code,
| u.phone,
| c.id departId
| from user u
| left join custom c on u.company = c.id
| where u.id = #{userId}
| </select>
|
| <!-- 获取检测人员信息 -->
| <select id="selectQualityUserList" resultType="com.ruoyi.common.core.domain.entity.User">
| select u1.id,
| u1.account,
| u1.name,
| u1.age,
| u1.email,
| u1.phone,
| u1.company,
| u1.is_custom,
| u1.signature_url,
| u1.picture_url,
| u1.name_en,
| u1.depart_lims_id
| from user u1
| left join sys_user_role sur on sur.user_id = u1.id
| where sur.role_id not in (1, 15, 16, 17)
| and u1.status = '0'
| group by u1.id
| </select>
|
| <!-- 获取当前登录用户部门下的所有用户 -->
| <select id="selectDepartmentLimsUserList" resultType="com.ruoyi.common.core.domain.entity.User">
| select id,
| account,
| name,
| name_en,
| status
| from user u
| where depart_lims_id is not null
| and depart_lims_id != ''
| and depart_lims_id = (select u2.depart_lims_id
| from user u2
| where u2.id = #{userId})
| </select>
|
| <select id="selectUserByDepartmentId" resultType="com.ruoyi.common.core.domain.entity.User"
| parameterType="java.lang.Integer">
| select id,
| dept_id,
| account,
| name,
| name_en,
| user_type,
| email,
| phone,
| sex,
| age,
| signature_url,
| picture_url,
| status,
| del_flag,
| login_ip,
| login_date,
| depart_lims_id,
| company,
| is_custom
| from user
| where del_flag = '0'
| and depart_lims_id is not null
| and depart_lims_id != ''
| and FIND_IN_SET(#{departmentId}, depart_lims_id)
| </select>
| <select id="selectUserListByPerformance" resultType="com.ruoyi.common.core.domain.entity.User">
| select
| *
| from user u
| <if test="isTestUser!=null and isTestUser">
| inner join sys_user_role sur on u.id = sur.user_id AND sur.role_id=4
| </if>
| where u.status = '0' and u.del_flag = '0'
| and u.dept_id=124
| ORDER BY u.sort
| </select>
|
| </mapper>
|
|