From eda58e0e6d4abdd2b060e28867d103045845aa69 Mon Sep 17 00:00:00 2001 From: 罗元桥 <2376770955@qq.com> Date: 星期一, 30 八月 2021 13:13:18 +0800 Subject: [PATCH] Merge branch 'test' into 'yuyue_dev' --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java | 35 +++++++++++++++++++++-------------- 1 files changed, 21 insertions(+), 14 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java index 47853a8..1e3589f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java @@ -1,5 +1,14 @@ package com.panzhihua.service_community.service.impl; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.panzhihua.common.model.vos.R; @@ -14,15 +23,7 @@ import com.panzhihua.service_community.model.dos.ComMngCityDO; import com.panzhihua.service_community.model.dos.ComMngDistrictDO; import com.panzhihua.service_community.model.dos.ComMngProvinceDO; -import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; import com.panzhihua.service_community.service.ComMngProvinceService; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; @Service public class ComMngProvinceServiceImpl implements ComMngProvinceService { @@ -53,7 +54,8 @@ @Override public R getCityByProvinceCode(Integer provinceAdcode) { - List<ComMngCityDO> comMngCityDOS = comMngCityDAO.selectList(new QueryWrapper<ComMngCityDO>().lambda().eq(ComMngCityDO::getProvinceAdcode, provinceAdcode)); + List<ComMngCityDO> comMngCityDOS = comMngCityDAO + .selectList(new QueryWrapper<ComMngCityDO>().lambda().eq(ComMngCityDO::getProvinceAdcode, provinceAdcode)); List<ComMngCityVO> vos = new ArrayList<>(); comMngCityDOS.forEach(c -> { ComMngCityVO vo = new ComMngCityVO(); @@ -63,10 +65,10 @@ return R.ok(vos); } - @Override public R getDistrictByCityCode(Integer cityAdcode) { - List<ComMngDistrictDO> comMngDistrictDOS = comMngDistrictDAO.selectList(new QueryWrapper<ComMngDistrictDO>().lambda().eq(ComMngDistrictDO::getCityAdcode, cityAdcode)); + List<ComMngDistrictDO> comMngDistrictDOS = comMngDistrictDAO + .selectList(new QueryWrapper<ComMngDistrictDO>().lambda().eq(ComMngDistrictDO::getCityAdcode, cityAdcode)); List<ComMngDistrictVO> vos = new ArrayList<>(); comMngDistrictDOS.forEach(c -> { ComMngDistrictVO vo = new ComMngDistrictVO(); @@ -78,18 +80,23 @@ @Override public R getCityTreeByProvinceCode(Integer provinceAdcode) { - List<ComMngProvinceDO> provinceDOS = comMngProvinceDAO.selectList(new QueryWrapper<ComMngProvinceDO>().lambda().eq(ComMngProvinceDO::getProvinceAdcode, provinceAdcode)); + List<ComMngProvinceDO> provinceDOS = comMngProvinceDAO.selectList( + new QueryWrapper<ComMngProvinceDO>().lambda().eq(ComMngProvinceDO::getProvinceAdcode, provinceAdcode)); List<ComMngCityDO> cityDOS = comMngCityDAO.selectList(new QueryWrapper<>()); List<ComMngDistrictDO> districtDOS = comMngDistrictDAO.selectList(new QueryWrapper<>()); List<ComMngAreaVO> vos = new ArrayList<>(); provinceDOS.forEach(p -> { ComMngAreaVO pvo = new ComMngAreaVO(p.getProvinceAdcode(), p.getProvinceName()); - List<ComMngCityDO> citys = cityDOS.stream().filter(city -> city.getProvinceAdcode().equals(p.getProvinceAdcode()) && city.getCityAdcode().equals(510400)).collect(Collectors.toList()); + List<ComMngCityDO> citys = cityDOS.stream().filter( + city -> city.getProvinceAdcode().equals(p.getProvinceAdcode()) && city.getCityAdcode().equals(510400)) + .collect(Collectors.toList()); citys.forEach(c -> { ComMngAreaVO cityVo = new ComMngAreaVO(c.getCityAdcode(), c.getCityName()); BeanUtils.copyProperties(c, cityVo); pvo.getChildren().add(cityVo); - List<ComMngDistrictDO> districts = districtDOS.stream().filter(district -> district.getCityAdcode().equals(c.getCityAdcode())).collect(Collectors.toList()); + List<ComMngDistrictDO> districts = + districtDOS.stream().filter(district -> district.getCityAdcode().equals(c.getCityAdcode())) + .collect(Collectors.toList()); districts.forEach(d -> { ComMngAreaVO districtVo = new ComMngAreaVO(d.getDistrictAdcode(), d.getDistrictName()); BeanUtils.copyProperties(d, districtVo); -- Gitblit v1.7.1