package com.gkhy.safePlatform.emergency.enums; import java.util.HashMap; import java.util.Map; public enum DrillEvaluationReportEnum { REPORT_ONE((byte) 1, "报告及时"), REPORT_TWO((byte) 2, "报告不及时"); private Byte code; private String value; DrillEvaluationReportEnum(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, 对外提供查询和遍历功能 public static Map toMap() { Map map = new HashMap(); for (DrillEvaluationReportEnum teamLevelEnum : DrillEvaluationReportEnum.values()) { map.put(teamLevelEnum.getCode(), teamLevelEnum); } return map; } public static DrillEvaluationReportEnum getByCode(Byte code){ return toMap().get(code); } }