迁移管理员逻辑
This commit is contained in:
@@ -26,12 +26,12 @@ public enum SystemErrorCodeEnum implements ServiceExceptionUtil.Enumerable<Syste
|
||||
ADMIN_NOT_FOUND(1002002000, "管理员不存在"),
|
||||
ADMIN_PASSWORD_ERROR(1002002001, "密码不正确"),
|
||||
ADMIN_IS_DISABLE(1002002002, "账号被禁用"),
|
||||
// ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"),
|
||||
// ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"),
|
||||
ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"),
|
||||
ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"),
|
||||
// ADMIN_DELETE_ONLY_DISABLE(1002002004, "只有关闭的账号才可以删除"),
|
||||
// ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"),
|
||||
ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"),
|
||||
// ADMIN_ASSIGN_ROLE_NOT_EXISTS(1002002006, "分配员工角色时,有角色不存在"),
|
||||
// ADMIN_ADMIN_CAN_NOT_UPDATE(1002002008, "管理员的账号不允许变更"),
|
||||
ADMIN_ADMIN_CAN_NOT_UPDATE(1002002008, "管理员的账号不允许变更"),
|
||||
|
||||
// ========== 资源模块 1002003000 ==========
|
||||
RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"),
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.mall.systemservice.enums.admin;
|
||||
|
||||
/**
|
||||
* 管理员的账号枚举,一般枚举特殊的账号
|
||||
*
|
||||
* 例如说,特殊管理员 admin 禁止编辑
|
||||
*/
|
||||
public enum AdminUsernameEnum {
|
||||
|
||||
ADMIN("admin"),
|
||||
DEMO("yudaoyuanma"),
|
||||
;
|
||||
|
||||
private final String username;
|
||||
|
||||
AdminUsernameEnum(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.mall.systemservice.enums.errorcode;
|
||||
|
||||
/**
|
||||
* 错误码的类型枚举
|
||||
*
|
||||
* @author ding
|
||||
*/
|
||||
public enum ErrorCodeTypeEnum {
|
||||
|
||||
/**
|
||||
* 内置错误码
|
||||
*/
|
||||
SYSTEM(1),
|
||||
/**
|
||||
* 自定义错误码
|
||||
*/
|
||||
CUSTOM(2);
|
||||
|
||||
private final Integer type;
|
||||
|
||||
ErrorCodeTypeEnum(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminCreateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminPageDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminUpdateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminVerifyPasswordDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO;
|
||||
|
||||
@@ -11,4 +15,10 @@ public interface AdminRpc {
|
||||
|
||||
CommonResult<AdminVO> verifyPassword(AdminVerifyPasswordDTO verifyPasswordDTO);
|
||||
|
||||
CommonResult<Integer> createAdmin(AdminCreateDTO createDTO);
|
||||
|
||||
CommonResult<Boolean> updateAdmin(AdminUpdateDTO updateDTO);
|
||||
|
||||
CommonResult<PageResult<AdminVO>> pageAdmin(AdminPageDTO pageDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 管理员添加 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminCreateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@NotEmpty(message = "昵称不能为空")
|
||||
@Length(max = 10, message = "昵称长度最大为 10 位")
|
||||
private String nickname;
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
@NotNull(message = "部门不能为空")
|
||||
private Integer departmentId;
|
||||
|
||||
/**
|
||||
* 登陆账号
|
||||
*/
|
||||
@NotEmpty(message = "登陆账号不能为空")
|
||||
@Length(min = 5, max = 16, message = "账号长度为 5-16 位")
|
||||
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 创建管理员编号
|
||||
*/
|
||||
@NotNull(message = "创建管理员编号不能为空")
|
||||
private String createAdminId;
|
||||
/**
|
||||
* 创建 IP
|
||||
*/
|
||||
@NotNull(message = "创建 IP 不能为空")
|
||||
private Date createIp;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.dto;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("管理员分页查询 DTO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class AdminPageDTO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "真实名字,模糊匹配", example = "小王")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "部门编号")
|
||||
private Integer departmentId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.dto;
|
||||
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 管理员修改 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminUpdateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 管理员编号
|
||||
*/
|
||||
@NotNull(message = "管理员编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@ApiModelProperty(value = "昵称", required = true, example = "小王")
|
||||
@Length(max = 10, message = "昵称长度最大为 10 位")
|
||||
private String nickname;
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
private Integer departmentId;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 登录账号
|
||||
*/
|
||||
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user