package com.diagbot.exception; /** * @Description: 通用错误码 * 系统码(3位) + 等级码(1位) + 4位顺序号 * 系统码 通用码 000;用户中心 100; 管理中心 200; * @author: gaodm * @time: 2018/8/1 14:56 */ public enum CommonErrorCode implements ErrorCode { OK("0", "操作成功"), FAIL("-1", "操作失败"), RPC_ERROR("-2","远程调度失败"), NOT_EXISTS ("00020001", "该数据不存在!"), INSERT_DATA_FAILED("00020002", "数据库写入失败!"), UPDATE_INFO_FAIL("00020003", "更新数据失败!"), PARAM_IS_NULL("00020004", "传入的参数为空!"), PARAM_IS_ERROR("00020005", "传入的参数为错误!"), STATUS_IS_ERROR("00020006", "参数状态错误!"); private String code; private String msg; CommonErrorCode(String code, String msg) { this.code = code; this.msg = msg; } public String getCode() { return code; } public String getMsg() { return msg; } public static CommonErrorCode codeOf(String code) { for (CommonErrorCode state : values()) { if (state.getCode() == code) { return state; } } return null; } }