From 27780b1573919ba914cd31e27655a10a8017c305 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Wed, 7 Sep 2022 19:09:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=88=A0=E9=99=A4=E8=A7=92=E8=89=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/iasf/service/impl/UserServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/huoran/iasf/service/impl/UserServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/UserServiceImpl.java index 5693037..36fd477 100644 --- a/src/main/java/com/huoran/iasf/service/impl/UserServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/UserServiceImpl.java @@ -197,10 +197,11 @@ public class UserServiceImpl extends ServiceImpl impleme vo.setEmail(vo.getPhone()); } - //删除所有部门 - userDeptMapper.delete(Wrappers.lambdaQuery().eq(UserDept::getUserId, vo.getId())); //更新部门 if (!CollectionUtils.isEmpty(vo.getDeptArchitectureId())) { + //删除所有部门 + userDeptMapper.delete(Wrappers.lambdaQuery().eq(UserDept::getUserId, vo.getId())); + List deptArchitectureId = vo.getDeptArchitectureId(); for (Integer deptId : deptArchitectureId) { UserDept userDept = new UserDept(); @@ -210,10 +211,12 @@ public class UserServiceImpl extends ServiceImpl impleme } } - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.eq(SysUserRole::getUserId, vo.getId()); - userRoleService.remove(queryWrapper); + if (!CollectionUtils.isEmpty(vo.getRoleIds())) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.eq(SysUserRole::getUserId, vo.getId()); + userRoleService.remove(queryWrapper); + UserRoleOperationReqVO reqVO = new UserRoleOperationReqVO(); reqVO.setUserId(vo.getId()); reqVO.setRoleIds(vo.getRoleIds());