id, account, name, birthday, sex, email, avatar,
phone, roleid,
deptid, status,
createtime, version
id, account, name, birthday,password, sex, email, avatar,
phone, roleid,salt,
deptid, status,
createtime, version
select
from sys_user
where status != 3
and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{name},'%'))
and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
update sys_user set status = #{status} where id =
#{userId}
update sys_user set password = #{pwd} where id =
#{userId}
update sys_user set roleid = #{roleIds} where id =
#{userId}
select *
from sys_user
where account = #{account}
and status != 3
SELECT * FROM (select CASE when d2.simplename is null then d1.simplename else d2.simplename end as parentName,
case when uu.sex = 1 then '男' when uu.sex = 2 then '女' else '' end as sexName,
d1.simplename as deptName,case when uu.status = 1 then '启用' when uu.status = 2 then '冻结' when uu.status = 3 then '删除' else '' end as statusName,
rr.roleName,
uu.* from sys_user as uu
LEFT JOIN sys_dept as d1 on d1.id = uu.deptid
LEFT JOIN sys_dept as d2 on d2.id = d1.pid
LEFT JOIN (select s.id,s.name,GROUP_CONCAT(r.name) as roleName from sys_user s
left join sys_role r on find_in_set(r.id,s.roleid) group by s.id) as rr on rr.id = uu.id
) as o
o.status != 3
and (o.phone like CONCAT('%',#{name},'%')
or o.account like CONCAT('%',#{name},'%')
or o.name like CONCAT('%',#{name},'%'))
and (o.deptid = #{deptid} or o.deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
and (o.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
and o.objectId = #{objectId}
order by o.id desc