package com.gkhy.safePlatform.emergency.enums; import java.util.HashMap; import java.util.Map; public enum DepartmentLevelEnum { COMPANY((byte)1,"公司"), BUSINESS((byte)2,"事业部"), WORKSHOP((byte)3,"车间"), GROUP((byte)4,"班组"), OTHER((byte)5,"其他"), ; DepartmentLevelEnum(Byte code, String value) { this.code = code; this.value = value; } ; public Byte code; public String value; static Map map; static { map = new HashMap<>(); for (DepartmentLevelEnum level : DepartmentLevelEnum.values()) { map.put(level.code, level); } } public static DepartmentLevelEnum parse(Byte code) { return map.get(code); } public Byte getCode() { return code; } public void setCode(Byte code) { this.code = code; } public static Map getMap() { return map; } public static void setMap(Map map) { DepartmentLevelEnum.map = map; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }