From fb00d486e0b6cf3be57b8b886bd4d329524f88ca Mon Sep 17 00:00:00 2001 From: chenhao Date: Wed, 3 Dec 2025 15:16:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(user):=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E5=85=A5=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加删除用户接口,支持批量删除 - 防止当前登录用户误删自己 - 简化Spring Web注解导入方式 - 增强用户管理的安全性和便利性 --- .../controller/system/SysUserController.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 8b55b5c1..2b33961e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -16,14 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -445,7 +438,18 @@ public class SysUserController extends BaseController { return editSave(user); } - + @RequiresPermissions("system:user:remove") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{id}") + @ResponseBody + public AjaxResult delete(@PathVariable("id") String ids) + { + if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId())) + { + return error("当前用户不能删除"); + } + return toAjax(userService.deleteUserByIds(ids)); + } // ----------------------新增的个人信息 业务处理--------------------------- // /** // * 个人信息