|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrGlobal.util; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson2.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.EnumValue; | 
|---|
|  |  |  | import com.dy.common.mybatis.envm.IEnum; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 行政区划级别 | 
|---|
|  |  |  | 
|---|
|  |  |  | this.name = name ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //用来转json | 
|---|
|  |  |  | public static List<Map> LevelList = new ArrayList<>(); | 
|---|
|  |  |  | static { | 
|---|
|  |  |  | DistrictLevel[] all = DistrictLevel.values(); | 
|---|
|  |  |  | for (DistrictLevel one : all) { | 
|---|
|  |  |  | Map<String, Object> objMap = new HashMap<>(); | 
|---|
|  |  |  | objMap.put("code", one.code); | 
|---|
|  |  |  | objMap.put("name", one.name); | 
|---|
|  |  |  | LevelList.add(objMap) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Byte getCode() { | 
|---|
|  |  |  | return this.code ; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static DistrictLevel get(Byte code){ | 
|---|
|  |  |  | if(code.byteValue() == Province.code.byteValue()){ | 
|---|
|  |  |  | return Province ; | 
|---|
|  |  |  | }if(code.byteValue() == City.code.byteValue()){ | 
|---|
|  |  |  | if(code.byteValue() == Province.code.byteValue()) { | 
|---|
|  |  |  | return Province; | 
|---|
|  |  |  | }else if(code.byteValue() == City.code.byteValue()){ | 
|---|
|  |  |  | return City ; | 
|---|
|  |  |  | }else if(code.byteValue() == County.code.byteValue()){ | 
|---|
|  |  |  | return County ; | 
|---|