ResultCodeEnum.java 883 Bytes
package cn.com.glsx.auditstatistics.enums;


import cn.com.glsx.auditstatistics.exception.BusinessException;

/**
 * <p>Description:
 * <p>Project: open-platform-admin
 *
 * @author wbh
 * @date 2020-12-16
 */
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    REQUEST_ERROR(401, "请求错误"),
    PARAM_ERROR(402, "参数错误"),
    SERVER_ERROR(500, "系统异常"),
    FILE_UPLOAD_ERROR(501, "文件上传失败"),
    FILE_DELETE_ERROR(502, "文件删除失败"),
    ;

    private final Integer code;
    private final String msg;

    ResultCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public BusinessException exception() {
        return new BusinessException(this.code, this.msg);
    }
}