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}
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}