首页>代码>springboot集成rabbitmq生产者消费者模型>/springboot-rabbitmq/src/main/java/com/simon/springbootrabbitmq/ApiErrorCode.java
package com.simon.springbootrabbitmq;
/**
* @author Simon
*/
public enum ApiErrorCode {
/**
* 失败
*/
FAILED(-1, "操作失败"),
/**
* 服务 异常
*/
SERVICE(500, "服务异常"),
/**
* 成功
*/
SUCCESS(0, "执行成功");
private final long code;
private final String msg;
ApiErrorCode(final long code, final String msg) {
this.code = code;
this.msg = msg;
}
public static ApiErrorCode fromCode(long code) {
ApiErrorCode[] ecs = ApiErrorCode.values();
for (ApiErrorCode ec : ecs) {
if (ec.getCode() == code) {
return ec;
}
}
return SUCCESS;
}
public long getCode() {
return code;
}
public String getMsg() {
return msg;
}
@Override
public String toString() {
return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
}
}
最近浏览更多
xp95323 LV15
6月10日
haitianjiaoyu0 LV8
5月27日
qinzhifang LV1
3月15日
笛卡尔积 LV6
2023年9月25日
duon12 LV1
2023年9月25日
gaoxin222 LV14
2023年6月16日
1529860026 LV24
2023年6月1日
3054069007 LV1
2023年5月29日
陆程江 LV2
2023年5月29日
北。 LV6
2023年4月28日

最近下载
