package com.gkhy.safePlatform.account.rpc.apimodel.model.enums; import java.util.HashMap; import java.util.Map; public enum DepartmentLevelEnum { COMPANY(1,"公司"), BUSINESS(2,"事业部"), WORKSHOP(3,"车间"), GROUP(4,"班组"), OTHER(5,"其他"), ; DepartmentLevelEnum(int code, String value) { this.code = code; this.value = value; } ; public int 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(Integer code) { return map.get(code); } }