xyc
2025-02-21 664db98c9e8595ce4dd636a27f480e3a08b81ff5
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
package com.zt.common.constant;
 
import com.zt.common.annotation.Dictionary;
 
import java.util.Arrays;
import java.util.Optional;
 
@Dictionary(type = "common_status", name = "通用状态")
public enum Layer implements IDictionary {
 
    MODEL(1, "model"),
    SIDE(2, "side"),
    SYSTEM1(3, "system1"),
    SYSTEM2(4, "system2"),
    EQUIPMENT(5, "equipment");
 
    private Integer value;
    private String name;
 
    Layer(int value, String name) {
        this.value = value;
        this.name = name;
    }
 
    @Override
    public Integer getValue() {
        return value;
    }
 
    @Override
    public String getName() {
        return name;
    }
 
    public static Integer get(String name) {
        return Arrays.stream(Layer.values())
                .filter(env -> env.name.equals(name)).findFirst().get().value;
    }
}