fuliqi
2024-06-06 528b1892d8e929b199dddc96f3a43f9b8039c8c8
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
package com.ycl.jxkg.domain.enums;
 
import java.util.HashMap;
import java.util.Map;
 
public enum VisibilityEnum {
    Private(1,"PRIVATE", "只有老师自己能看"),
    Public(2,"PUBLIC", "所有人能看");
    Integer code;
    String name;
    String description;
 
    VisibilityEnum(Integer code,String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }
 
    public String getDescription() {
        return description;
    }
 
    public void setDescription(String description) {
        this.description = description;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public Integer getCode() {
        return code;
    }
 
    public void setCode(Integer code) {
        this.code = code;
    }
 
    private static final Map<Integer, VisibilityEnum> keyMap = new HashMap<>();
 
    static {
        for (VisibilityEnum item : VisibilityEnum.values()) {
            keyMap.put(item.getCode(), item);
        }
    }
    public static VisibilityEnum fromCode(Integer code) {
        return keyMap.get(code);
    }
 
}