From 8555f974846ca5b4f4734f52b51e39cd4502df44 Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期五, 02 四月 2021 15:46:30 +0800
Subject: [PATCH] fix:修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
index 9960566..0770984 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
@@ -13,9 +13,11 @@
 import com.panzhihua.common.model.vos.community.ComMngVillageVO;
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComActVillageDAO;
+import com.panzhihua.service_community.dao.ComMngPopulationDAO;
 import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO;
 import com.panzhihua.service_community.model.dos.ComActDO;
 import com.panzhihua.service_community.model.dos.ComActDiscussDO;
+import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
 import com.panzhihua.service_community.model.dos.ComMngVillageDO;
 import com.panzhihua.service_community.service.ComMngVillageService;
 import org.springframework.beans.BeanUtils;
@@ -38,6 +40,8 @@
     ComActVillageDAO comActVillageDAO;
     @Resource
     ComActDAO comActDAO;
+    @Resource
+    ComMngPopulationDAO populationDAO;
 
     @Override
     public R addComActVillage(ComMngVillageVO comMngVillageVO) {
@@ -100,6 +104,12 @@
 
     @Override
     public R delecComActVillage(List<Long> Ids) {
+        LambdaQueryWrapper<ComMngPopulationDO> paramWrapper = Wrappers.lambdaQuery();
+        paramWrapper.in(ComMngPopulationDO::getVillageId, Ids);
+        ComMngPopulationDO mngPopulationDO = populationDAO.selectOne(paramWrapper);
+        if (mngPopulationDO != null) {
+            return R.fail("无法删除,已绑定实有人口!");
+        }
         int delete = comActVillageDAO.deleteBatchIds(Ids);
         if (delete > 0) {
             return R.ok();

--
Gitblit v1.7.1