增加数据字典 tree 接口

管理员账号,不允许改变状态
pull/1/head
YunaiV 2019-03-06 23:08:35 +08:00
parent 63dd545c50
commit c4d5e459e6
3 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package cn.iocoder.mall.admin.api.constant;
public class AdminConstants {
public static final String USERNAME_ADMIN = "admin";
}

View File

@ -27,6 +27,7 @@ public enum AdminErrorCodeEnum {
ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"), ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"),
ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"), ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"),
ADMIN_DELETE_ONLY_DISABLE(1002002004, "只有关闭的账号才可以删除"), ADMIN_DELETE_ONLY_DISABLE(1002002004, "只有关闭的账号才可以删除"),
ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"),
// ========== 资源模块 1002003000 ========== // ========== 资源模块 1002003000 ==========
RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"), RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"),

View File

@ -7,6 +7,7 @@ import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.api.AdminService; import cn.iocoder.mall.admin.api.AdminService;
import cn.iocoder.mall.admin.api.bo.AdminBO; import cn.iocoder.mall.admin.api.bo.AdminBO;
import cn.iocoder.mall.admin.api.bo.AdminPageBO; import cn.iocoder.mall.admin.api.bo.AdminPageBO;
import cn.iocoder.mall.admin.api.constant.AdminConstants;
import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum; import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum;
import cn.iocoder.mall.admin.api.dto.AdminAddDTO; import cn.iocoder.mall.admin.api.dto.AdminAddDTO;
import cn.iocoder.mall.admin.api.dto.AdminPageDTO; import cn.iocoder.mall.admin.api.dto.AdminPageDTO;
@ -125,6 +126,9 @@ public class AdminServiceImpl implements AdminService {
if (admin == null) { if (admin == null) {
return ServiceExceptionUtil.error(AdminErrorCodeEnum.ADMIN_USERNAME_NOT_REGISTERED.getCode()); return ServiceExceptionUtil.error(AdminErrorCodeEnum.ADMIN_USERNAME_NOT_REGISTERED.getCode());
} }
if (AdminConstants.USERNAME_ADMIN.equals(admin.getUsername())) {
return ServiceExceptionUtil.error(AdminErrorCodeEnum.ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE.getCode());
}
// 如果状态相同,则返回错误 // 如果状态相同,则返回错误
if (status.equals(admin.getStatus())) { if (status.equals(admin.getStatus())) {
return ServiceExceptionUtil.error(AdminErrorCodeEnum.ADMIN_STATUS_EQUALS.getCode()); return ServiceExceptionUtil.error(AdminErrorCodeEnum.ADMIN_STATUS_EQUALS.getCode());