|
|
|
@ -4090,35 +4090,55 @@ |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 04-MHM 责任人:role(7,8) + user_role + users --> |
|
|
|
<!-- 04-MHM 责任人:operator 表 + users(排除 admin、仓管角色43) --> |
|
|
|
<select id="getMhmResponsibleOperatorList" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData"> |
|
|
|
SELECT DISTINCT |
|
|
|
u.id as userId, |
|
|
|
u.username as adminID, |
|
|
|
u.display as adminName, |
|
|
|
u.department as departmentName, |
|
|
|
ur.role_id as roleId, |
|
|
|
r.name as roleName |
|
|
|
FROM users u |
|
|
|
INNER JOIN user_role ur ON u.id = ur.user_id |
|
|
|
INNER JOIN role r ON ur.role_id = r.id |
|
|
|
<where> |
|
|
|
ur.role_id IN (7, 8) |
|
|
|
AND (u.active = 'Y' OR u.active IS NULL) |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
AND u.site = #{site} |
|
|
|
</if> |
|
|
|
<if test="adminID != null and adminID != ''"> |
|
|
|
AND u.username LIKE '%' + #{adminID} + '%' |
|
|
|
</if> |
|
|
|
<if test="adminName != null and adminName != ''"> |
|
|
|
AND u.display LIKE '%' + #{adminName} + '%' |
|
|
|
</if> |
|
|
|
<if test="roleId != null and roleId != ''"> |
|
|
|
AND ur.role_id = #{roleId} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY u.username |
|
|
|
SELECT DISTINCT userId, adminID, adminName, departmentName, roleId, roleName FROM ( |
|
|
|
SELECT |
|
|
|
NULL as userId, |
|
|
|
o.operator_id as adminID, |
|
|
|
o.operator_name as adminName, |
|
|
|
NULL as departmentName, |
|
|
|
NULL as roleId, |
|
|
|
N'操作员' as roleName |
|
|
|
FROM operator o |
|
|
|
<where> |
|
|
|
(o.active = 'Y' OR o.active IS NULL) |
|
|
|
AND LOWER(o.operator_id) <> 'admin' |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
AND o.site = #{site} |
|
|
|
</if> |
|
|
|
<if test="adminID != null and adminID != ''"> |
|
|
|
AND o.operator_id LIKE '%' + #{adminID} + '%' |
|
|
|
</if> |
|
|
|
<if test="adminName != null and adminName != ''"> |
|
|
|
AND o.operator_name LIKE '%' + #{adminName} + '%' |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
UNION ALL |
|
|
|
SELECT |
|
|
|
u.id as userId, |
|
|
|
u.username as adminID, |
|
|
|
u.display as adminName, |
|
|
|
u.department as departmentName, |
|
|
|
NULL as roleId, |
|
|
|
NULL as roleName |
|
|
|
FROM users u |
|
|
|
<where> |
|
|
|
(u.active = 'Y' OR u.active IS NULL) |
|
|
|
AND LOWER(u.username) <> 'admin' |
|
|
|
AND NOT EXISTS (SELECT 1 FROM user_role ur2 WHERE ur2.user_id = u.id AND ur2.role_id = 43) |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
AND u.site = #{site} |
|
|
|
</if> |
|
|
|
<if test="adminID != null and adminID != ''"> |
|
|
|
AND u.username LIKE '%' + #{adminID} + '%' |
|
|
|
</if> |
|
|
|
<if test="adminName != null and adminName != ''"> |
|
|
|
AND u.display LIKE '%' + #{adminName} + '%' |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
) t |
|
|
|
ORDER BY adminID |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getMhmResponsibleRoleList" resultType="com.xujie.sys.modules.pms.data.EamAdminData"> |
|
|
|
|