Browse Source

sysuercontroller remove self 问题修复

duandazhi 4 years ago
parent
commit
dd70c1950e

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java

@@ -5,6 +5,8 @@ import java.util.List;
5
 import java.util.Set;
5
 import java.util.Set;
6
 import java.util.stream.Collectors;
6
 import java.util.stream.Collectors;
7
 import javax.servlet.http.HttpServletResponse;
7
 import javax.servlet.http.HttpServletResponse;
8
+
9
+import org.apache.commons.lang3.ArrayUtils;
8
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.validation.annotation.Validated;
11
 import org.springframework.validation.annotation.Validated;
10
 import org.springframework.web.bind.annotation.DeleteMapping;
12
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -217,6 +219,9 @@ public class SysUserController extends BaseController
217
     @DeleteMapping("/{userIds}")
219
     @DeleteMapping("/{userIds}")
218
     public AjaxResult remove(@PathVariable Long[] userIds)
220
     public AjaxResult remove(@PathVariable Long[] userIds)
219
     {
221
     {
222
+        if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) {
223
+            return AjaxResult.error("当前用户不能删除");
224
+        }
220
         return toAjax(userService.deleteUserByIds(userIds));
225
         return toAjax(userService.deleteUserByIds(userIds));
221
     }
226
     }
222
 
227