package com.gkhy.safePlatform.incidentManage.enums;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public enum AccidentReportTypeEnum {
|
|
TYPE_ONE((byte) 1, "人员伤亡事故"),
|
TYPE_TWO((byte) 2, "火灾爆炸事故"),
|
TYPE_THREE((byte) 3, "危险品泄露事故"),
|
TYPE_FOUR((byte) 4, "设备事故"),
|
TYPE_FIVE((byte) 5, "工艺事故");
|
|
|
private Byte code;
|
private String value;
|
|
AccidentReportTypeEnum(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, AccidentReportTypeEnum> toMap() {
|
Map<Byte, AccidentReportTypeEnum> map = new HashMap();
|
for (AccidentReportTypeEnum accidentExpressEnum : AccidentReportTypeEnum.values()) {
|
map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
|
}
|
return map;
|
}
|
public static AccidentReportTypeEnum getByCode(Byte code){
|
return toMap().get(code);
|
}
|
}
|