From 3200842b39790902aad7bdeaf8255fede8f201b5 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Fri, 28 Oct 2022 16:26:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/modules/system/rest/UserController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/rest/UserController.java b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/rest/UserController.java index 051e2f30..af923631 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/rest/UserController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/rest/UserController.java @@ -34,6 +34,7 @@ import org.nl.modules.system.service.VerifyService; import org.nl.modules.system.service.UserService; import org.nl.utils.PageUtil; +import org.nl.utils.RedisUtils; import org.nl.utils.RsaUtils; import org.nl.utils.SecurityUtils; import org.nl.utils.enums.CodeEnum; @@ -67,6 +68,7 @@ public class UserController { private final DataService dataService; private final DeptService deptService; private final RoleService roleService; + private final RedisUtils redisUtils; private final VerifyService verificationCodeService; @ApiOperation("导出用户数据") @@ -145,6 +147,12 @@ public class UserController { if (currentLevel > optLevel) { throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername()); } + // 删除缓存信息 + UserDto userDto = userService.findById(id); + redisUtils.del("data::user:" + userDto.getId()); + redisUtils.del("menu::user:" + userDto.getId()); + redisUtils.del("role::auth:" + userDto.getId()); + redisUtils.del("user::username:" + userDto.getUsername()); } userService.delete(ids); return new ResponseEntity<>(HttpStatus.OK);