package com.gkhy.safePlatform.emergency.enums;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public enum EmergencyPlanTypeEnum {
|
|
TYPE_ONE((byte) 1, "综合应急预案"),
|
TYPE_TWO((byte) 2, "现场处置预案"),
|
TYPE_THREE((byte) 3, "专项应急预案"),
|
TYPE_FOUR((byte) 4, "其他预案");
|
|
private Byte code;
|
private String value;
|
|
EmergencyPlanTypeEnum(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, EmergencyPlanTypeEnum> toMap() {
|
Map<Byte, EmergencyPlanTypeEnum> map = new HashMap();
|
for (EmergencyPlanTypeEnum teamLevelEnum : EmergencyPlanTypeEnum.values()) {
|
map.put(teamLevelEnum.getCode(), teamLevelEnum);
|
}
|
return map;
|
}
|
public static EmergencyPlanTypeEnum getByCode(Byte code){
|
return toMap().get(code);
|
}
|
}
|