sgj
4 天以前 f71f31780ed55200f3e370e61c81cfd05feb34bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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;
    }
}