From 0a328de1fdd348538fd2ac654c64528896d35e04 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 27 十一月 2023 15:48:00 +0800 Subject: [PATCH] .iml文件放入gitignore --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 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 index f841907..a4fd7e4 100644 --- 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 @@ -3,17 +3,20 @@ 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, "闀�"), - Village((byte)4, "鏉�"), - Group((byte)5, "缁�"); + Village((byte)4, "鏉�") ; @EnumValue public Byte code ; @@ -24,6 +27,15 @@ this.name = name ; } + //鐢ㄦ潵杞琷son + 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 ; @@ -33,4 +45,19 @@ public String getName() { return this.name ; } + + public static DistrictLevel get(Byte code){ + 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 ; + }else if(code.byteValue() == Town.code.byteValue()){ + return Town ; + }else if(code.byteValue() == Village.code.byteValue()){ + return Village ; + } + return null ; + } } -- Gitblit v1.8.0