select * from sys_user
where 1=1
and orgid = #{orgid}
and username = #{username}
and mobile = #{mobile}
and status = #{status}
ORDER BY orgid,code
LIMIT #{total},#{size}
insert into sys_role_users values (#{id},#{roleid},#{userid})
select id,roleid,userid from sys_role_users where roleid=#{roleid} and userid=#{userid}
select id,level,rolename, from sys_role where id in (select roleid from sys_role_users where userid=#{userid} )
select roleid from sys_role_users where userid=#{userid}
SELECT MIN(TO_NUMBER(t.level_col))
FROM (
SELECT r."LEVEL" AS level_col
FROM sys_role r
WHERE r.id IN (SELECT roleid FROM sys_role_users WHERE userid = #{userId})
) t
SELECT DISTINCT
u.id,
u.usertype,
u.username,
u.nickname,
u.sex,
u.email,
u.phone,
u.avatar,
u.orgid,
u.status,
u.lastmodifier,
u.lastmodifydate
FROM
sys_user u
WHERE
1 = 1
AND ( ( u.REG_STATUS != 0 AND u.REG_STATUS != 2 ) OR u.REG_STATUS IS NULL )
AND u.usertype != 0
and u.orgid = #{orgid}
and u.username LIKE '%' || #{username} || '%'
ORDER BY u.lastmodifydate DESC
SELECT DISTINCT
u.id AS "id",
u.username AS "username",
u.nickname AS "nickname",
u.email AS "email",
u.phone AS "phone",
u.avatar AS "avatar",
o.orgname AS "orgname",
o.id AS "oid",
op.orgname AS "porgname",
op.id AS "poid"
FROM sys_user u
INNER JOIN sys_organization o ON u.orgid = o.id
INNER JOIN sys_organization op ON o.parentid = op.id
WHERE u.id = #{id}
delete from sys_role_users where userid=#{userid}
delete from sys_role_users
where
userid=#{userid}
and roleid not in
#{roleids}
DELETE FROM sys_role_users WHERE userid IN
#{id}