From dd70c1950ebb0090a95d156aa857ccdc991875a2 Mon Sep 17 00:00:00 2001 From: duandazhi Date: Wed, 28 Jul 2021 10:24:14 +0800 Subject: [PATCH] =?UTF-8?q?sysuercontroller=20remove=20self=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/system/controller/SysUserController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index db88224..9e8bcec 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -217,6 +219,9 @@ public class SysUserController extends BaseController @DeleteMapping("/{userIds}") public AjaxResult remove(@PathVariable Long[] userIds) { + if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { + return AjaxResult.error("当前用户不能删除"); + } return toAjax(userService.deleteUserByIds(userIds)); }