From 1a2b07f01ba4616fd9e894dddf474b56d020158c Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 07 四月 2025 15:18:51 +0800
Subject: [PATCH] 整理版本

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java
new file mode 100644
index 0000000..8e49596
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java
@@ -0,0 +1,69 @@
+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;
+
+/**
+ * 琛屾斂鍖哄垝绾у埆
+ * Provinces, cities, counties, towns, and village groups
+ */
+public enum DistrictLevel implements IEnum {
+
+    Province((byte)0, "鐪�"),
+    City((byte)1, "甯�"),
+    County((byte)2, "鍘�"),
+    Town((byte)3,  "闀�"),
+    Village((byte)4,  "鏉�") ;
+
+    @EnumValue
+    public Byte code ;
+    public String name ;
+
+    DistrictLevel(Byte code, String name){
+        this.code = code ;
+        this.name = name ;
+    }
+
+    //鐢ㄦ潵杞琷son
+    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 ;
+    }
+
+    @Override
+    public String getName() {
+        return this.name ;
+    }
+
+    public static DistrictLevel get(Byte code){
+        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 ;
+        }else if(code.byteValue() == Town.code.byteValue()){
+            return Town ;
+        }else if(code.byteValue() == Village.code.byteValue()){
+            return Village ;
+        }
+        return null ;
+    }
+}

--
Gitblit v1.8.0