优化用户不能删除自己
This commit is contained in:
parent
7736097f6b
commit
3243428009
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -173,6 +174,10 @@ public class SysUserController extends BaseController
|
|||||||
@DeleteMapping("/{userIds}")
|
@DeleteMapping("/{userIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||||
{
|
{
|
||||||
|
if (ArrayUtils.contains(userIds, getUserId()))
|
||||||
|
{
|
||||||
|
return error("当前用户不能删除");
|
||||||
|
}
|
||||||
return toAjax(userService.deleteUserByIds(userIds));
|
return toAjax(userService.deleteUserByIds(userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user