From ff37f2fed3c479e5c664e5bff0834e37f400eceb Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期五, 16 四月 2021 09:22:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java | 16 ++++++++++++++++ 1 files changed, 16 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..698ada9 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) { @@ -52,6 +56,9 @@ } BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId()); + if (comActDO == null || comActDO.getStreetId() == null) { + return R.fail("社区没有绑定街道,请绑定后操作!"); + } comMngVillageDO.setStreetId(comActDO.getStreetId()); int insert = comActVillageDAO.insert(comMngVillageDO); if (insert > 0) { @@ -100,6 +107,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(); @@ -130,6 +143,9 @@ index++; } ComActDO comActDO = comActDAO.selectById(communityId); + if(comActDO.getStreetId()==null||comActDO.getStreetId().toString().equals("")){ + return R.fail("请绑定街道,再操作!"); + } ArrayList<ComMngVillageDO> comMngVillageDOS = Lists.newArrayList(); list.forEach(vo -> { ComMngVillageDO comMngVillageDO = new ComMngVillageDO(); -- Gitblit v1.7.1