ResultCodeEnum.java 666 Bytes
package com.glsx.enums;

import com.glsx.exception.BusinessException;

/**
 * <p>Description:
 * <p>Project: open-platform-admin
 *
 * @author wbh
 * @date 2020-12-16
 */
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    SERVER_ERROR(500, "系统异常"),
    ;

    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);
    }
}