liurunyu
2023-11-27 478ae07891f64484d8a483e15821ce0bc920606f
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java
@@ -3,12 +3,16 @@
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.dy.common.mybatis.envm.IEnum;
import java.util.HashMap;
import java.util.Map;
/**
 * 行政区划级别
 * Provinces, cities, counties, towns, and village groups
 */
public enum DistrictLevel implements IEnum {
    Province((byte)0, "省"),
    City((byte)1, "市"),
    County((byte)2, "县"),
    Town((byte)3,  "镇"),
@@ -23,6 +27,15 @@
        this.name = name ;
    }
    //用来转json
    public static Map<Byte, String> ObjMap = new HashMap<>();
    static {
        DistrictLevel[] all = DistrictLevel.values();
        for (DistrictLevel one : all) {
            ObjMap.put(one.code, one.name);
        }
    }
    @Override
    public Byte getCode() {
        return this.code ;
@@ -34,7 +47,9 @@
    }
    public static DistrictLevel get(Byte code){
        if(code.byteValue() == City.code.byteValue()){
        if(code.byteValue() == Province.code.byteValue()){
            return Province ;
        }if(code.byteValue() == City.code.byteValue()){
            return City ;
        }else if(code.byteValue() == County.code.byteValue()){
            return County ;