From 610065c78311dbf5085998943612f153456e4672 Mon Sep 17 00:00:00 2001 From: fengjin <1435304038@qq.com> Date: 星期五, 30 九月 2022 13:24:48 +0800 Subject: [PATCH] 修改Bug --- flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java b/flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java index 01d7434..f1ba531 100644 --- a/flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java +++ b/flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java @@ -40,20 +40,23 @@ areaCodes.add(organizationChartEntity.getVillage()); getAreaCodeIds(areaCodes,organizationChartEntity); } - return baseMapper.selectByIdSet(areaCodes); + if (areaCodes.size()==0) + return null; + else + return baseMapper.selectByIdSet(areaCodes); } public List<String> getAreaCodeIds(List<String> areaCodes, OrganizationChartEntity organizationChartEntity){ - organizationChartEntity = organizationChartMapper.selectOne(new QueryWrapper<OrganizationChartEntity>().lambda() + List<OrganizationChartEntity> organizationChartEntitys= organizationChartMapper.selectList(new QueryWrapper<OrganizationChartEntity>().lambda() .eq(OrganizationChartEntity::getParentId, organizationChartEntity.getId())); - if (organizationChartEntity!=null){ - if (organizationChartEntity.getCity()!=null) - areaCodes.add(organizationChartEntity.getCity()); - if (organizationChartEntity.getDistrict()!=null) - areaCodes.add(organizationChartEntity.getDistrict()); - if (organizationChartEntity.getVillage()!=null) - areaCodes.add(organizationChartEntity.getVillage()); - getAreaCodeIds(areaCodes,organizationChartEntity); + for (OrganizationChartEntity organizationChart:organizationChartEntitys) { + if (organizationChart.getCity()!=null) + areaCodes.add(organizationChart.getCity()); + if (organizationChart.getDistrict()!=null) + areaCodes.add(organizationChart.getDistrict()); + if (organizationChart.getVillage()!=null) + areaCodes.add(organizationChart.getVillage()); + getAreaCodeIds(areaCodes,organizationChart); } return areaCodes; } -- Gitblit v1.7.1