liding
3 天以前 7f9e375391e30fd3c367cb5a080a609a6e25e524
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.zbkj.common.exception;
 
/**
 *  Exception 拦截
 */
public enum ExceptionCodeEnum implements ExceptionHandler{
    // 数据操作错误定义
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    PRAM_NOT_MATCH(400, "参数不正确"),
    VALIDATE_FAILED(400, "参数检验失败"),
    UNAUTHORIZED(401, "未登录或token过期,请登录!"),
    FORBIDDEN(403, "没有相关权限"),
    NOT_FOUND(404, "没有找到相关数据"),
    ERROR(500, "系统异常"),
    ;
 
    private long code;
    private String message;
 
    private ExceptionCodeEnum(long code, String message){
        this.code = code;
        this.message = message;
    }
 
    @Override
    public long getCode() {
        return code;
    }
 
    @Override
    public String getMessage() {
        return message;
    }
}