liurunyu
2023-11-27 3d7669b78c751f808d17b92be18b800cdf595844
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
package com.dy.pipIrrGlobal.util;
 
 
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.EnumValue;
 
import java.util.HashMap;
import java.util.Map;
 
public enum Org {
 
    Ym("ym", "元谋"),
    Pj("pj", "片角镇") ;
 
    @EnumValue
    public String tag ;
    public String name ;
 
    Org(String tag, String name){
        this.tag = tag ;
        this.name = name ;
    }
    //用来转json
    public static Map<String, Org> ObjMap = new HashMap<String, Org>();
    static {
        Org[] all = Org.values();
        for (Org one : all) {
            ObjMap.put(one.tag, one);
        }
    }
 
    public String getTag() {
        return this.tag ;
    }
 
    public String getName() {
        return this.name ;
    }
 
    public static Org get(String tag){
        if(tag.equals(Ym.tag)){
            return Ym ;
        }else if(tag.equals(Pj.tag)){
            return Pj ;
        }
        return null ;
    }
 
 
    @JSONField
    public JSONObject toJson() {
        return JSONObject.of("tag", getTag(), "name", getName());
    }
}