select id,roleid,userid from sys_role_users where roleid=#{roleid}
select a.id roleusersid,
a.roleid roleid,
a.userid userid,
b.code usercode,
b.username username,
b.orgid userorgid,
b.avatar useravatar,
b.email useremail,
b.mobile usermobile,
b.account useraccount,
b.lastupdatetime userlastupdatetime,
b.status userstatus,
b.lastmodifier userlastmodifier,
b.lastmodifydate userlastmodifydate,
c.rolename rolename,
c.level rolelevel,
c.description roledescription,
c.orgscope roleorgscope,
c.optscope roleoptscope,
c.busscope rolebusscope,
c.isvaild roleisvaild,
c.lastmodifier rolelastmodifier,
c.lastmodifydate rolelastmodifydate
from sys_role_users a LEFT JOIN sys_user b on a.userid =b.id left join
sys_role c on a.roleid = c.id
where
1=1
and b.orgid = #{orgid}
and b.username like "%"#{username}"%"
and b.status=#{status}
and c.level=#{level}
and c.rolename=#{rolename}
and c.isvaild=#{isvaild}
ORDER BY c.level,b.orgid,b.code
SELECT r.id,r.rolename,r.orgscope FROM sys_role_users ru INNER JOIN sys_role r ON ru.roleid =r.id WHERE ru.userid =#{id}
select userid from sys_role_users where roleid=#{roleid}
SELECT r.id, r.rolename, r.orgscope
FROM sys_role r
INNER JOIN sys_role_users ru ON r.id = ru.roleid
WHERE ru.userid = #{id}
SELECT roleid
FROM sys_role_users
WHERE userid = #{id}
SELECT r.id, r.rolecode, r.rolename, r."LEVEL", r.description,
r.orgscope, r.optscope, r.busscope, r.isvaild,
r.lastmodifier, r.lastmodifydate, r.custom1, r.custom2, r.custom3
FROM sys_role r
AND r.rolename LIKE '%' || #{rolename} || '%'
AND r."LEVEL" != '1'
ORDER BY r."LEVEL" ASC, lastmodifydate ASC
delete from sys_role_users where userid !=(select u.id from sys_user u where u.account="admin") and roleid=#{roleid} and userid=#{urserid}
DELETE FROM sys_role_users WHERE roleid= #{id}