From 677748bebf97bce64bad889dc5358f2a86d2901a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=89=E5=A4=9A=E5=AE=9D=E5=AE=9D?= Date: Tue, 13 Jan 2026 11:02:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=88=A0=E9=99=A4=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=95=86=E6=97=B6=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A7=92=E8=89=B2=E5=85=B3=E7=B3=BB=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppAgentEmployeeRelationServiceImpl.java | 4 +++- .../teach/user/api/UserInfoServiceApi.java | 3 +++ .../admin/api/UserInfoServiceApiImpl.java | 21 +++++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentEmployeeRelationServiceImpl.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentEmployeeRelationServiceImpl.java index ac1449c..b02d526 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentEmployeeRelationServiceImpl.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentEmployeeRelationServiceImpl.java @@ -148,9 +148,11 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel public boolean deleteEmployee(Integer id) { MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getById(id); AssertUtils.notNull(existing, ResultCodeEnum.DATA_NOT_EXIST); + Integer userId = existing.getEmployeeUserId(); boolean result = mpAgentEmployeeRelationService.removeById(id); log.info("删除员工结果:{}", result); - return result; + boolean deleteUserResult = userInfoServiceApi.deleteUserRoleByUserId(userId); + return result && deleteUserResult; } @Override diff --git a/seer-user/seer-user-api/src/main/java/com/seer/teach/user/api/UserInfoServiceApi.java b/seer-user/seer-user-api/src/main/java/com/seer/teach/user/api/UserInfoServiceApi.java index 8225b1e..a93fba4 100644 --- a/seer-user/seer-user-api/src/main/java/com/seer/teach/user/api/UserInfoServiceApi.java +++ b/seer-user/seer-user-api/src/main/java/com/seer/teach/user/api/UserInfoServiceApi.java @@ -198,4 +198,7 @@ public interface UserInfoServiceApi { @DeleteMapping("/deleteUserRoleByUserIds") boolean deleteUserRoleByUserId(@RequestParam("userIds") List userIds); + @DeleteMapping("/deleteUserRoleByUserId") + boolean deleteUserRoleByUserId(@RequestParam("userId") Integer userId); + } \ No newline at end of file diff --git a/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java b/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java index 5086f6e..a550064 100644 --- a/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java +++ b/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java @@ -240,7 +240,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi { userEntity.setPassword(CommonUtils.encryptPassword(userInfoDTO.getPassword())); boolean saved = userService.save(userEntity); log.info("保存用户信息:{}", saved); - if(saved){ + if (saved) { userRoleService.assignUserRoleByRoleCode(userEntity.getId(), userInfoDTO.getRoleCode().getCode()); return userEntity.getId(); } @@ -298,6 +298,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi { log.info("注册默认Children User:{}", userEntity); return userEntity.getId(); } + @Override public Integer checkUserInfo(Integer userId) { UserExtendEntity byUserId = userExtendService.getByUserId(userId); @@ -335,7 +336,23 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi { log.info("准备删除角色记录,ID列表: {}", ids); boolean result = userRoleService.removeByIds(ids); log.info("删除角色结果: {}", result); - return result; + // 删除用户信息 + boolean userResult = userService.removeByIds(userIds); + log.info("删除用户信息结果: {}", userResult); + return result && userResult; + } + + @Override + public boolean deleteUserRoleByUserId(Integer userId) { + UserRoleEntity one = userRoleService.lambdaQuery().eq(UserRoleEntity::getUserId, userId).one(); + if (one != null) { + // 删除用户信息 + userService.removeById(userId); + // 删除用户角色 + return userRoleService.removeById(one); + } + log.info("用户角色不存在"); + return false; } /**