delete from sys_user_role where user_id = #{userId} delete from sys_user_role where user_id in #{userId} insert into sys_user_role(user_id, role_id) values (#{item.userId},#{item.roleId}) delete from sys_user_role where user_id=#{userId} and role_id=#{roleId} delete from sys_user_role where role_id=#{roleId} and user_id in #{userId}