|
|
@ -5,66 +5,75 @@ |
|
|
|
<!-- ${ew.customSqlSegment} --> |
|
|
|
<select id="selectPageVo" resultType="com.yxt.portal.biz.sysuser.SysUserVo"> |
|
|
|
SELECT DISTINCT user.staffSid, |
|
|
|
user.userType, |
|
|
|
user.accountType, |
|
|
|
user.createTime, |
|
|
|
user.isEnable, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(org.name) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid |
|
|
|
) departmentName, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(org.sid) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid and staffOrg.manageType!=2 |
|
|
|
) departmentSid, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(post.name) |
|
|
|
FROM sys_staff_post staffPost |
|
|
|
LEFT JOIN sys_post post ON post.sid = staffPost.postSid |
|
|
|
WHERE staffPost.staffSid = user.staffSid |
|
|
|
) postName, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(post.sid) |
|
|
|
FROM sys_staff_post staffPost |
|
|
|
LEFT JOIN sys_post post ON post.sid = staffPost.postSid |
|
|
|
WHERE staffPost.staffSid = user.staffSid |
|
|
|
) postSid, |
|
|
|
user.userName, |
|
|
|
user.sid sid, |
|
|
|
staff.name, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(role.name) |
|
|
|
FROM sys_user_role user_role |
|
|
|
LEFT JOIN sys_role role ON role.sid = user_role.roleSid |
|
|
|
WHERE user_role.userSid = USER.sid and user_role.orgSid=SUBSTRING_INDEX(c.orgSidPath,'/',1) |
|
|
|
) roleName, |
|
|
|
c.sid as orgSid |
|
|
|
-- dict.dictValue userType, |
|
|
|
user.userType, |
|
|
|
user.accountType, |
|
|
|
user.createTime, |
|
|
|
user.isEnable, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(org.name) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid |
|
|
|
) departmentName, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(org.sid) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid and staffOrg.manageType!=2 |
|
|
|
) departmentSid, |
|
|
|
( |
|
|
|
SELECT |
|
|
|
GROUP_CONCAT( org.sid ) |
|
|
|
FROM |
|
|
|
sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE |
|
|
|
staffOrg.staffSid = USER.staffSid |
|
|
|
AND staffOrg.manageType != 2 AND org.orgSidPath like #{orgSid} |
|
|
|
) orgSid, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(post.name) |
|
|
|
FROM sys_staff_post staffPost |
|
|
|
LEFT JOIN sys_post post ON post.sid = staffPost.postSid |
|
|
|
WHERE staffPost.staffSid = user.staffSid |
|
|
|
) postName, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(post.sid) |
|
|
|
FROM sys_staff_post staffPost |
|
|
|
LEFT JOIN sys_post post ON post.sid = staffPost.postSid |
|
|
|
WHERE staffPost.staffSid = user.staffSid |
|
|
|
) postSid, |
|
|
|
user.userName, |
|
|
|
user.sid sid, |
|
|
|
staff.name, |
|
|
|
( |
|
|
|
SELECT GROUP_CONCAT(role.name) |
|
|
|
FROM sys_user_role user_role |
|
|
|
LEFT JOIN sys_role role ON role.sid = user_role.roleSid |
|
|
|
WHERE user_role.userSid = USER.sid and user_role.orgSid=SUBSTRING_INDEX(c.orgSidPath,'/',1) |
|
|
|
) roleName |
|
|
|
-- dict.dictValue userType, |
|
|
|
FROM sys_user USER |
|
|
|
LEFT JOIN sys_user_role user_role ON user_role.userSid = USER.sid |
|
|
|
LEFT JOIN sys_role role ON role.sid = user_role.roleSid |
|
|
|
-- LEFT JOIN dict_common dict ON dict.dictKey = user.userType AND dict.dictType = 'userType' |
|
|
|
LEFT JOIN sys_staffinfo staff ON staff.sid = user.staffSid |
|
|
|
left join sys_staff_org a on a.staffSid=staff.sid |
|
|
|
left join sys_org_authorize b on b.orgSid=a.orgSid |
|
|
|
LEFT JOIN sys_user_role user_role ON user_role.userSid = USER.sid |
|
|
|
LEFT JOIN sys_role role ON role.sid = user_role.roleSid |
|
|
|
-- LEFT JOIN dict_common dict ON dict.dictKey = user.userType AND dict.dictType = 'userType' |
|
|
|
LEFT JOIN sys_staffinfo staff ON staff.sid = user.staffSid |
|
|
|
left join sys_staff_org a on a.staffSid=staff.sid |
|
|
|
left join sys_org_authorize b on b.orgSid=a.orgSid |
|
|
|
left join sys_organization c on c.sid=a.orgSid |
|
|
|
|
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
<if test="orgName != null and orgName != ''"> |
|
|
|
AND (SELECT GROUP_CONCAT(org.name) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid) |
|
|
|
LIKE concat('%', |
|
|
|
#{orgName} |
|
|
|
, |
|
|
|
'%' |
|
|
|
) |
|
|
|
FROM sys_staff_org staffOrg |
|
|
|
LEFT JOIN sys_organization org ON org.sid = staffOrg.orgSid |
|
|
|
WHERE staffOrg.staffSid = user.staffSid) |
|
|
|
LIKE concat('%', |
|
|
|
#{orgName} |
|
|
|
, |
|
|
|
'%' |
|
|
|
) |
|
|
|
</if> |
|
|
|
<if test="userName != null and userName != ''"> |
|
|
|
and |
|
|
@ -211,8 +220,7 @@ |
|
|
|
LEFT JOIN sys_staff_org sso ON su.staffSid = sso.staffSid |
|
|
|
LEFT JOIN sys_organization so ON sso.orgSid = so.sid |
|
|
|
WHERE su.sid = #{userSid} |
|
|
|
ORDER BY sso.id |
|
|
|
LIMIT 1 |
|
|
|
ORDER BY sso.id LIMIT 1 |
|
|
|
</select> |
|
|
|
<!--根据用户的sid查询用户的组织信息:多个时取第一个--> |
|
|
|
<select id="selectUserInfoByUserSid" resultType="com.yxt.portal.biz.sysuser.SysUserInfoVo"> |
|
|
@ -222,8 +230,7 @@ |
|
|
|
LEFT JOIN sys_staff_org sso ON su.staffSid = sso.staffSid |
|
|
|
LEFT JOIN sys_organization so ON sso.orgSid = so.sid |
|
|
|
WHERE su.sid = #{userSid} |
|
|
|
ORDER BY sso.id |
|
|
|
LIMIT 1 |
|
|
|
ORDER BY sso.id LIMIT 1 |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectUserInfoByUserSidOne" resultType="com.yxt.portal.biz.sysuser.SysUserInfoVo"> |
|
|
@ -234,8 +241,7 @@ |
|
|
|
LEFT JOIN sys_organization so ON sso.orgSid = so.sid |
|
|
|
WHERE su.sid = #{userSid} |
|
|
|
and find_in_set(#{orgSid}, replace(sso.orgSidPath, '/', ',')) |
|
|
|
ORDER BY sso.id |
|
|
|
LIMIT 1 |
|
|
|
ORDER BY sso.id LIMIT 1 |
|
|
|
</select> |
|
|
|
<!--根据员工sid更新用户表的工号以及手机号--> |
|
|
|
<update id="updateByStaffSid"> |
|
|
@ -279,11 +285,11 @@ |
|
|
|
<select id="getUserByRole" resultType="com.yxt.portal.biz.sysuser.SysUserVo"> |
|
|
|
select distinct si.name, su.sid, su.staffSid<!--, so.orgSidPath--> |
|
|
|
from sys_user_role sr |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
where sr.roleSid = #{roleSid} |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
@ -321,7 +327,7 @@ |
|
|
|
<select id="fetchBySids" resultType="com.yxt.portal.biz.sysuser.SysUserVo"> |
|
|
|
select su.*, ss.name |
|
|
|
from sys_user su |
|
|
|
left join sys_staffinfo ss on su.staffSid = ss.sid |
|
|
|
left join sys_staffinfo ss on su.staffSid = ss.sid |
|
|
|
where su.sid in |
|
|
|
<foreach collection="sids" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
@ -358,13 +364,13 @@ |
|
|
|
<select id="getUserMessageByRole" resultType="com.yxt.portal.biz.sysuser.SysUserVo"> |
|
|
|
select distinct si.name, su.sid, su.staffSid, so.orgSidPath |
|
|
|
from sys_user_role sr |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
where sr.roleSid = #{roleSid} |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
AND so.`manageType` = 3 |
|
|
|
and su.sid in |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
AND so.`manageType` = 3 |
|
|
|
and su.sid in |
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
@ -373,13 +379,13 @@ |
|
|
|
<select id="getUserSidMessageByRole" resultType="java.lang.String"> |
|
|
|
select distinct su.sid |
|
|
|
from sys_user_role sr |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
left join sys_user su on sr.userSid = su.sid |
|
|
|
left join sys_staffinfo si on si.sid = su.staffSid |
|
|
|
left join sys_staff_org so on so.staffSid = si.sid |
|
|
|
where sr.roleSid = #{roleSid} |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
AND so.`manageType` = 3 |
|
|
|
and su.sid in |
|
|
|
and find_in_set(#{levelOrgSid}, replace(so.orgSidPath, '/', ',')) |
|
|
|
AND so.`manageType` = 3 |
|
|
|
and su.sid in |
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
@ -405,7 +411,7 @@ |
|
|
|
<select id="selectUserByStaffSid" resultType="java.lang.String"> |
|
|
|
select su.sid |
|
|
|
from sys_user su |
|
|
|
left join sys_staffinfo si on su.staffSid = si.sid where su.staffSid in |
|
|
|
left join sys_staffinfo si on su.staffSid = si.sid where su.staffSid in |
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
@ -416,6 +422,7 @@ |
|
|
|
select su.token |
|
|
|
from sys_staffinfo si |
|
|
|
left join sys_user su on su.staffSid = si.sid |
|
|
|
where si.personTypeKey = '01' and length(su.token)>0 |
|
|
|
where si.personTypeKey = '01' |
|
|
|
and length(su.token) > 0 |
|
|
|
</select> |
|
|
|
</mapper> |