package pwc.taxtech.atms.constant.enums; public enum EnumApiUpdateFlag { MANUAL_UPDATE(0, "人工更新"), IMPORT_UPDATES(1, "导入更新"); private Integer code; private String name; EnumApiUpdateFlag(Integer code, String name) { this.code = code; this.name = name; } public Integer getCode() { return code; } public String getName() { return name; } public static EnumApiUpdateFlag fromCode(Integer code){ for(EnumApiUpdateFlag type: EnumApiUpdateFlag.values()){ if(type.getCode().intValue()==code.intValue())return type; } // 超出范围值默认返回人工更新 return EnumApiUpdateFlag.MANUAL_UPDATE; } public static String getName(Integer code){ for(EnumApiUpdateFlag type: EnumApiUpdateFlag.values()){ if(type.getCode().intValue()==code.intValue())return type.name; } // 超出范围值默认返回人工更新 return EnumApiUpdateFlag.MANUAL_UPDATE.name; } }