From 8f60343ef26b4e06dde4aa7c14b157d5c81b6423 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 16 十一月 2023 15:54:02 +0800
Subject: [PATCH] 行政区添加canAdd和canDelete属性,并实现判断行政区是否可以添加下级行政区,及是否可以删除本级行政区
---
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java | 10 ++++++++++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java | 11 +++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java
index 51f8bd6..d88ab02 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java
@@ -82,4 +82,15 @@
@TableField(exist = false)
public List<BaDistrict> subDistricts ;
+ /**
+ * 涓嬬骇琛屾斂鍖洪泦鍚�
+ */
+ @Schema(description = "鏄惁鍙互娣讳笅绾э紝琛ㄥ崟涓嶇敤濉啓锛屽彧鍦ㄦ煡璇㈠垪琛ㄦ椂鏈夋晥", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @TableField(exist = false)
+ public boolean canAdd ;
+
+ @Schema(description = "鏄惁鍙互鍒犻櫎锛岃〃鍗曚笉鐢ㄥ~鍐欙紝鍙湪鏌ヨ鍒楄〃鏃舵湁鏁�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+ @TableField(exist = false)
+ public boolean canDelete ;
+
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
index ff2cfeb..32dd927 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
@@ -2,6 +2,7 @@
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
+import com.dy.pipIrrGlobal.util.DistrictLevel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -29,6 +30,8 @@
List<BaDistrict> list = this.dao.selectByLevel(firstLevel) ;
if(list != null && list.size() > 0){
for(BaDistrict po : list){
+ po.canDelete = false ;
+ po.canAdd = true ;
getSubDistrict(po) ;
}
}
@@ -85,6 +88,13 @@
for(BaDistrict subPo : po.subDistricts){
getSubDistrict(subPo) ;
}
+ }else{
+ //娌℃湁涓嬬骇浜嗭紝鍙互鍒犻櫎
+ po.canDelete = false ;
+ if(po.level.code.byteValue() == DistrictLevel.Village.code.byteValue()){
+ //鍒版潙绾т簡锛屼笉鍙互鍐嶆坊鍔犺鏀垮尯浜�
+ po.canAdd = false ;
+ }
}
}
}
--
Gitblit v1.8.0