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());
|
}
|
}
|