feat(user): 新增用户删除功能并优化导入注解

- 添加删除用户接口,支持批量删除
- 防止当前登录用户误删自己
- 简化Spring Web注解导入方式
- 增强用户管理的安全性和便利性
dev_1.0.0
chenhao 2025-12-03 15:16:34 +08:00
parent 65fc038b7c
commit fb00d486e0
1 changed files with 13 additions and 9 deletions

View File

@ -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));
}
// ----------------------新增的个人信息 业务处理---------------------------
// /**
// * 个人信息