select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
insert into sys_user(
user_id,
dept_id,
user_name,
nick_name,
email,
avatar,
phonenumber,
sex,
password,
status,
create_by,
remark,
create_time
)values(
#{userId},
#{deptId},
#{userName},
#{nickName},
#{email},
#{avatar},
#{phonenumber},
#{sex},
#{password},
#{status},
#{createBy},
#{remark},
sysdate()
)
update sys_user
dept_id = #{deptId},
user_name = #{userName},
nick_name = #{nickName},
email = #{email},
phonenumber = #{phonenumber},
sex = #{sex},
avatar = #{avatar},
password = #{password},
status = #{status},
login_ip = #{loginIp},
login_date = #{loginDate},
update_by = #{updateBy},
remark = #{remark},
update_time = sysdate()
where user_id = #{userId}
update sys_user set status = #{status} where user_id = #{userId}
update sys_user set avatar = #{avatar} where user_name = #{userName}
update sys_user set password = #{password} where user_name = #{userName}
delete from sys_user where user_id = #{userId}