| | |
| | | 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 |
| | |
| | | this.name = name ; |
| | | } |
| | | |
| | | //用来转json |
| | | public static Map<Byte, DistrictLevel> ObjMap = new HashMap<Byte, DistrictLevel>(); |
| | | static { |
| | | DistrictLevel[] all = DistrictLevel.values(); |
| | | for (DistrictLevel one : all) { |
| | | ObjMap.put(one.code, one); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Byte getCode() { |
| | | return this.code ; |
| | |
| | | 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", "元谋"), |
| | |
| | | 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 null ; |
| | | } |
| | | |
| | | |
| | | @JSONField |
| | | public JSONObject toJson() { |
| | | return JSONObject.of("tag", getTag(), "name", getName()); |
| | |
| | | }) |
| | | @GetMapping(path = "allLevel") |
| | | public BaseResponse<List<DistrictLevel>> allDistrictLevels(){ |
| | | List<DistrictLevel> list = Arrays.asList(DistrictLevel.City, DistrictLevel.County, DistrictLevel.Town, DistrictLevel.Village) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | //List<DistrictLevel> list = Arrays.asList(DistrictLevel.City, DistrictLevel.County, DistrictLevel.Town, DistrictLevel.Village) ; |
| | | return BaseResponseUtils.buildSuccess(DistrictLevel.ObjMap); |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | @GetMapping(path = "allOrg") |
| | | public BaseResponse<List<Org>> allOrg(){ |
| | | List<Org> list = Arrays.asList(Org.Ym, Org.Pj) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | //List<Org> list = Arrays.asList(Org.Ym, Org.Pj) ; |
| | | return BaseResponseUtils.buildSuccess(Org.ObjMap); |
| | | } |
| | | |
| | | /** |