package com.gkhy.safePlatform.incidentManage.enums;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public enum AccidentReportLevelEnum {
|
|
LEVEL_ONE((byte) 1, "特大事故"),
|
LEVEL_TWO((byte) 2, "重大事故"),
|
LEVEL_THREE((byte) 3, "较大事故"),
|
LEVEL_FOUR((byte) 4, "一般事故"),
|
LEVEL_FIVE((byte) 5, "未遂事故");
|
|
|
private Byte code;
|
private String value;
|
|
AccidentReportLevelEnum(Byte code, String value) {
|
this.code = code;
|
this.value = value;
|
}
|
|
public Byte getCode() {
|
return code;
|
}
|
|
public void setCode(Byte code) {
|
this.code = code;
|
}
|
|
public String getValue() {
|
return value;
|
}
|
|
public void setValue(String value) {
|
this.value = value;
|
}
|
|
// 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
|
public static Map<Byte, AccidentReportLevelEnum> toMap() {
|
Map<Byte, AccidentReportLevelEnum> map = new HashMap();
|
for (AccidentReportLevelEnum accidentExpressEnum : AccidentReportLevelEnum.values()) {
|
map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
|
}
|
return map;
|
}
|
public static AccidentReportLevelEnum getByCode(Byte code){
|
return toMap().get(code);
|
}
|
}
|