songhuangfeng123
2022-09-16 f4994092d9b3c6dcb60aaa0672eb283245ff5d8c
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
package com.gkhy.safePlatform.equipment.enums;
 
import java.util.HashMap;
import java.util.Map;
 
public enum EquipmentStopStatusEnum {
 
    STOP_STATUS_ONE((byte) 1, "停用"),
    STOP_STATUS_TWO((byte) 2, "在用"),
    STOP_STATUS_THREE((byte) 3, "维修"),
    STOP_STATUS_FOUR((byte) 4, "报废");
 
 
    private Byte code;
    private String value;
 
    EquipmentStopStatusEnum(Byte code, String value) {
        this.code = code;
        this.value = value;
    }
 
    public Byte getCode() {
        return code;
    }
 
    public void setCode(Byte code) {
        this.code = code;
    }
 
    public String getValue() {
        return value;
    }
 
    public void setValue(String value) {
        this.value = value;
    }
 
    // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
    public static Map<Byte, EquipmentStopStatusEnum> toMap() {
        Map<Byte, EquipmentStopStatusEnum> map = new HashMap();
        for (EquipmentStopStatusEnum accidentExpressEnum : EquipmentStopStatusEnum.values()) {
            map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
        }
        return map;
    }
    public static EquipmentStopStatusEnum getByCode(Byte code){
        return toMap().get(code);
    }
}