package com.fzzy.igds.constant; import lombok.Getter; /** * 监控点位类型枚举 */ @Getter public enum MonitorPointType { ENTRANCE_EXIT("1", "出入口"), SAMPLING_MACHINE("2", "扦样机"), LABORATORY("3", "化验室"), SETTLEMENT_ROOM("4", "结算室"), WEIGHBRIDGE_ROOM("5", "地磅室"), WAREHOUSE_MAIN_ROAD("6", "库区主干道"), INTER_WAREHOUSE_MONITOR("7", "仓间监控"), IN_WAREHOUSE("8", "仓内"), MEDICINE_ROOM("9", "药品房内外"), EQUIPMENT_ROOM("10", "器材室内外"), HIGH_POINT("11", "制高点"), OIL_TANK_AREA("12", "油库罐区"), OIL_RECEIVE_EQUIPMENT("13", "收发油设备"), PUMP_ROOM("14", "泵房"), OIL_PIPELINE("15", "油库主要输送管道"), PERIMETER("16", "周界"); private final String code; private final String name; MonitorPointType(String code, String name) { this.code = code; this.name = name; } /** * 根据code获取枚举 * @param code 编码 * @return 对应的枚举值,未找到返回null */ public static MonitorPointType getByCode(String code) { if (code == null) { return null; } for (MonitorPointType type : values()) { if (type.getCode().equals(code)) { return type; } } return null; } /** * 根据code获取描述 * @param code 编码 * @return 对应的描述,未找到返回null */ public static String getNameByCode(String code) { MonitorPointType type = getByCode(code); return type != null ? type.name() : null; } }