u.id AS user_id, u.photo, u.login_id, u.name AS user_name, u.identity, u.password, u.email, u.create_time AS user_create_time, u.status AS user_status, u.company_id AS "company.id", c.name AS "company.name", c.parent_id AS "company.parent.id", c.parent_ids AS "company.parentIds", c.type AS "company.type", c.grade AS "company.grade", c.job_type AS "company.job_type", u.office_id AS "office.id", o.name AS "office.name", o.parent_id AS "office.parent.id", o.parent_ids AS "office.parentIds", o.type AS "office.type", o.grade AS "office.grade", o.job_type AS "office.job_type", u.entity_id AS "entity.id", e.name AS "entity.name", e.parent_id AS "entity.parent.id", e.parent_ids AS "entity.parentIds", e.type AS "entity.type", e.grade AS "entity.grade", e.job_type AS "entity.job_type", r.id AS role_id, r.name AS role_name, r.data_scope, r.remark AS role_desc, r.status AS role_status, r.create_time AS role_create_time LEFT JOIN sys_office c ON c.id = u.company_id AND c.useable=1 LEFT JOIN sys_office e ON e.id=u.entity_id AND e.useable=1 LEFT JOIN sys_office o ON o.id=u.office_id AND o.useable=1 LEFT JOIN sys_inter_user_role ir ON u.id=ir.user_id LEFT JOIN sys_role r ON r.id=ir.role_id AND r.status=1 insert into sys_user(LOGIN_ID,PHOTO,NAME,IDENTITY,EMAIL,PASSWORD,CREATE_TIME,STATUS,COMPANY_ID,ENTITY_ID,OFFICE_ID) values(#{loginId},#{photo},#{name},#{identity},#{email},#{password},#{createTime},#{status},#{company.id},#{entity.id},#{office.id}) UPDATE sys_user SET login_id= #{loginId}, password = #{password}, name = #{name}, identity = #{identity}, photo = #{photo}, email = #{email}, company_id = #{company.id}, entity_id = #{entity.id}, office_id = #{office.id} WHERE id = #{id} INSERT INTO sys_inter_user_role(role_id, user_id) SELECT #{role.id},#{id} FROM dual INSERT INTO sys_inter_user_office(office_id, user_id) SELECT #{office.id},#{id} FROM dual DELETE FROM sys_inter_user_role WHERE user_id = #{id} DELETE FROM sys_inter_user_role WHERE user_id = #{userId} and role_id = #{roleId} DELETE FROM sys_inter_user_office WHERE user_id = #{id} UPDATE sys_user SET status = #{DEL_FLAG_DELETE} WHERE id = #{id} UPDATE sys_user SET email = #{email}, photo = #{photo} WHERE id = #{id} UPDATE sys_user SET password = #{password} WHERE id = #{id}