mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-05-08 16:20:43 +08:00
增加系统管理员校验
This commit is contained in:
@@ -95,7 +95,8 @@ public class SystemAuthAdminController {
|
||||
@Log(title = "管理员编辑")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody SystemAdminUpdateValidate updateValidate) {
|
||||
iSystemAuthAdminService.edit(updateValidate);
|
||||
Integer adminId = LikeAdminThreadLocal.getAdminId();
|
||||
iSystemAuthAdminService.edit(updateValidate, adminId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@ public interface ISystemAuthAdminService {
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
* @param adminId 管理员ID
|
||||
*/
|
||||
void edit(SystemAdminUpdateValidate updateValidate);
|
||||
void edit(SystemAdminUpdateValidate updateValidate, Integer adminId);
|
||||
|
||||
/**
|
||||
* 当前管理员更新
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.system.SystemAuthAdmin;
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.system.SystemAuthAdminMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthMenuMapper;
|
||||
import com.mdd.common.utils.*;
|
||||
@@ -245,9 +246,14 @@ public class SystemAuthAdminServiceImpl implements ISystemAuthAdminService {
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
* @param adminId 管理员ID
|
||||
*/
|
||||
@Override
|
||||
public void edit(SystemAdminUpdateValidate updateValidate) {
|
||||
public void edit(SystemAdminUpdateValidate updateValidate, Integer adminId) {
|
||||
if (adminId.equals(1) && !adminId.equals(updateValidate.getId())) {
|
||||
throw new OperateException("您无权限编辑系统管理员!");
|
||||
}
|
||||
|
||||
String[] field = {"id", "username", "nickname"};
|
||||
Assert.notNull(systemAuthAdminMapper.selectOne(new QueryWrapper<SystemAuthAdmin>()
|
||||
.select(field)
|
||||
|
||||
Reference in New Issue
Block a user