refacor:系统代码优化,优化字典管理

This commit is contained in:
haoxr 2021-01-30 23:51:04 +08:00
parent 07233324cc
commit fcfb9cff0e
6 changed files with 69 additions and 66 deletions

View File

@ -9,6 +9,6 @@ import org.springframework.web.bind.annotation.PathVariable;
@FeignClient(value = "youlai-admin")
public interface UserFeignService {
@GetMapping("/users/username/{username}")
@GetMapping("/api.admin/v1/users/username/{username}")
Result<UserDTO> getUserByUsername(@PathVariable String username);
}

View File

@ -4,27 +4,19 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class SysDict extends BaseEntity {
public class SysDict extends BaseEntity {
@TableId(type= IdType.AUTO)
@TableId(type = IdType.AUTO)
private Long id;
private String code;
private String name;
private String value;
private String typeCode;
private String sort;
private Integer status;
private Integer defaulted;
private String remark;
private String remark;
}

View File

@ -4,21 +4,27 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
public class SysDictType extends BaseEntity {
@Accessors(chain = true)
public class SysDictItem extends BaseEntity {
@TableId(type = IdType.AUTO)
@TableId(type= IdType.AUTO)
private Long id;
private String code;
private String name;
private String value;
private String dictCode;
private String sort;
private Integer status;
private String remark;
private Integer defaulted;
private String remark;
}

View File

@ -97,6 +97,11 @@
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- spring cloud 2020.0.0内置的openfeign3.0.0和spring cloud alibaba框架nacos、seata冲突临时解决方案-->
<dependency>
<groupId>org.springframework.cloud</groupId>

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
/**
* @author haoxr
@ -43,7 +42,7 @@ public class Result<T> implements Serializable {
return result(ResultCode.SYSTEM_EXECUTION_ERROR.getCode(), msg, null);
}
public static <T> Result<T> status(boolean status) {
public static <T> Result<T> judge(boolean status) {
if (status) {
return success();
} else {

View File

@ -11,64 +11,65 @@ import java.io.Serializable;
**/
@AllArgsConstructor
@NoArgsConstructor
public enum ResultCode implements IResultCode, Serializable {
public enum ResultCode implements IResultCode, Serializable {
SUCCESS("00000","一切ok"),
SUCCESS("00000", "一切ok"),
USER_ERROR("A0001","用户端错误"),
USER_LOGIN_ERROR("A0200","用户登录异常"),
USER_ERROR("A0001", "用户端错误"),
USER_LOGIN_ERROR("A0200", "用户登录异常"),
USER_NOT_EXIST("A0201","用户不存在"),
USER_ACCOUNT_LOCKED("A0202","用户账户被冻结"),
USER_ACCOUNT_INVALID("A0203","用户账户已作废"),
USER_NOT_EXIST("A0201", "用户不存在"),
USER_ACCOUNT_LOCKED("A0202", "用户账户被冻结"),
USER_ACCOUNT_INVALID("A0203", "用户账户已作废"),
USERNAME_OR_PASSWORD_ERROR("A0210","用户名或密码错误"),
INPUT_PASSWORD_EXCEED_LIMIT("A0211","用户输入密码次数超限"),
CLIENT_AUTHENTICATION_FAILED("A0212","客户端认证失败"), // *
TOKEN_INVALID_OR_EXPIRED("A0230","token无效或已过期"),
USERNAME_OR_PASSWORD_ERROR("A0210", "用户名或密码错误"),
INPUT_PASSWORD_EXCEED_LIMIT("A0211", "用户输入密码次数超限"),
CLIENT_AUTHENTICATION_FAILED("A0212", "客户端认证失败"), // *
TOKEN_INVALID_OR_EXPIRED("A0230", "token无效或已过期"),
AUTHORIZED_ERROR ("A0300","访问权限异常"),
ACCESS_UNAUTHORIZED ("A0301","访问未授权"),
FORBIDDEN_OPERATION ("A0302","演示环境禁止修改、删除重要数据,请本地部署后测试"),
AUTHORIZED_ERROR("A0300", "访问权限异常"),
ACCESS_UNAUTHORIZED("A0301", "访问未授权"),
FORBIDDEN_OPERATION("A0302", "演示环境禁止修改、删除重要数据,请本地部署后测试"),
USER_REQUEST_PARAM_ERROR("A0400","用户请求参数错误"),
USER_REQUEST_PARAM_IS_BLANK("A0410","请求必填参数为空"),
PARAM_ERROR("A0400", "用户请求参数错误"),
PARAM_IS_NULL("A0410", "请求必填参数为空"),
QUERY_MODE_IS_NULL("A0411", "查询模式为空"),
USER_UPLOAD_FILE_ERROR("A0700","用户上传文件异常"),
USER_UPLOAD_FILE_TYPE_NOT_MATCH("A0701","用户上传文件类型不匹配"),
USER_UPLOAD_FILE_SIZE_EXCEEDS("A0702","用户上传文件太大"),
USER_UPLOAD_IMAGE_SIZE_EXCEEDS("A0703","用户上传图片太大"),
USER_UPLOAD_FILE_ERROR("A0700", "用户上传文件异常"),
USER_UPLOAD_FILE_TYPE_NOT_MATCH("A0701", "用户上传文件类型不匹配"),
USER_UPLOAD_FILE_SIZE_EXCEEDS("A0702", "用户上传文件太大"),
USER_UPLOAD_IMAGE_SIZE_EXCEEDS("A0703", "用户上传图片太大"),
SYSTEM_EXECUTION_ERROR("B0001","系统执行出错"),
SYSTEM_EXECUTION_TIMEOUT("B0100","系统执行超时"),
SYSTEM_ORDER_PROCESSING_TIMEOUT("B0100","系统订单处理超时"),
SYSTEM_EXECUTION_ERROR("B0001", "系统执行出错"),
SYSTEM_EXECUTION_TIMEOUT("B0100", "系统执行超时"),
SYSTEM_ORDER_PROCESSING_TIMEOUT("B0100", "系统订单处理超时"),
SYSTEM_DISASTER_RECOVERY_TRIGGER("B0200","系统容灾功能被出发"),
SYSTEM_LIMITING("B0210","系统限流"),
SYSTEM_FUNCTION_DEGRADATION("B0220","系统功能降级"),
SYSTEM_DISASTER_RECOVERY_TRIGGER("B0200", "系统容灾功能被出发"),
SYSTEM_LIMITING("B0210", "系统限流"),
SYSTEM_FUNCTION_DEGRADATION("B0220", "系统功能降级"),
SYSTEM_RESOURCE_ERROR("B0300","系统资源异常"),
SYSTEM_RESOURCE_EXHAUSTION("B0310","系统资源耗尽"),
SYSTEM_RESOURCE_ACCESS_ERROR("B0320","系统资源访问异常"),
SYSTEM_READ_DISK_FILE_ERROR("B0321","系统读取磁盘文件失败"),
SYSTEM_RESOURCE_ERROR("B0300", "系统资源异常"),
SYSTEM_RESOURCE_EXHAUSTION("B0310", "系统资源耗尽"),
SYSTEM_RESOURCE_ACCESS_ERROR("B0320", "系统资源访问异常"),
SYSTEM_READ_DISK_FILE_ERROR("B0321", "系统读取磁盘文件失败"),
CALL_THIRD_PARTY_SERVICE_ERROR("C0001","调用第三方服务出错"),
MIDDLEWARE_SERVICE_ERROR("C0100","中间件服务出错"),
INTERFACE_NOT_EXIST("C0113","接口不存在"),
CALL_THIRD_PARTY_SERVICE_ERROR("C0001", "调用第三方服务出错"),
MIDDLEWARE_SERVICE_ERROR("C0100", "中间件服务出错"),
INTERFACE_NOT_EXIST("C0113", "接口不存在"),
MESSAGE_SERVICE_ERROR("C0120","消息服务出错"),
MESSAGE_DELIVERY_ERROR("C0121","消息投递出错"),
MESSAGE_CONSUMPTION_ERROR("C0122","消息消费出错"),
MESSAGE_SUBSCRIPTION_ERROR("C0123","消息订阅出错"),
MESSAGE_GROUP_NOT_FOUND("C0124","消息分组未查到"),
MESSAGE_SERVICE_ERROR("C0120", "消息服务出错"),
MESSAGE_DELIVERY_ERROR("C0121", "消息投递出错"),
MESSAGE_CONSUMPTION_ERROR("C0122", "消息消费出错"),
MESSAGE_SUBSCRIPTION_ERROR("C0123", "消息订阅出错"),
MESSAGE_GROUP_NOT_FOUND("C0124", "消息分组未查到"),
DATABASE_ERROR("C0300","数据库服务出错"),
DATABASE_TABLE_NOT_EXIST("C0311","表不存在"),
DATABASE_COLUMN_NOT_EXIST("C0312","列不存在"),
DATABASE_DUPLICATE_COLUMN_NAME("C0321","多表关联中存在多个相同名称的列"),
DATABASE_DEADLOCK("C0331","数据库死锁"),
DATABASE_PRIMARY_KEY_CONFLICT("C0341","主键冲突") ;
DATABASE_ERROR("C0300", "数据库服务出错"),
DATABASE_TABLE_NOT_EXIST("C0311", "表不存在"),
DATABASE_COLUMN_NOT_EXIST("C0312", "列不存在"),
DATABASE_DUPLICATE_COLUMN_NAME("C0321", "多表关联中存在多个相同名称的列"),
DATABASE_DEADLOCK("C0331", "数据库死锁"),
DATABASE_PRIMARY_KEY_CONFLICT("C0341", "主键冲突");
@Override
public String getCode() {