select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, r.status, r.del_flag, r.create_time, r.remark from sys_role r left join sys_user_role urs on urs.role_id = r.role_id left join sys_user u on u.user_id = urs.user_id left join sys_dept d on u.dept_id = d.dept_id insert into sys_role( role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, remark, create_by, create_time )values( #{roleId}, #{roleName}, #{roleKey}, #{roleSort}, #{dataScope}, #{menuCheckStrictly}, #{deptCheckStrictly}, #{status}, #{remark}, #{createBy}, sysdate() ) update sys_role role_name = #{roleName}, role_key = #{roleKey}, role_sort = #{roleSort}, data_scope = #{dataScope}, menu_check_strictly = #{menuCheckStrictly}, dept_check_strictly = #{deptCheckStrictly}, status = #{status}, remark = #{remark}, update_by = #{updateBy}, update_time = sysdate() where role_id = #{roleId} update sys_role set del_flag = '2' where role_id = #{roleId} update sys_role set del_flag = '2' where role_id in #{roleId}