mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.panzhihua.service_community.service.impl;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngStructAreaCityVO;
import com.panzhihua.common.model.vos.community.ComMngStructAreaDistrictVO;
import com.panzhihua.common.model.vos.community.ComMngStructAreaProvinceVO;
import com.panzhihua.service_community.dao.ComMngStructAreaDistrictDAO;
import com.panzhihua.service_community.model.dos.ComMngStructAreaDistrictDO;
import com.panzhihua.service_community.service.ComMngStructAreaDistrictService;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 地址
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-01-27 15:02
 **/
@Service
public class ComMngStructAreaDistrictServiceImpl implements ComMngStructAreaDistrictService {
    @Resource
    private ComMngStructAreaDistrictDAO comMngStructAreaDistrictDAO;
 
    /**
     * 查询城市下属所有地区列表
     *
     * @param cityAdcode
     *            城市地址编码
     * @return 地区列表
     */
    @Override
    public R listAreaDistrict(Long cityAdcode) {
        List<ComMngStructAreaProvinceVO> comMngStructAreaProvinceVOS = new ArrayList<>();
        ComMngStructAreaProvinceVO comMngStructAreaProvinceVO = new ComMngStructAreaProvinceVO();
        comMngStructAreaProvinceVO.setId(23L);
        comMngStructAreaProvinceVO.setProvinceAdcode(510000);
        comMngStructAreaProvinceVO.setProvinceName("四川省");
        List<ComMngStructAreaCityVO> comMngStructAreaCityVOS = new ArrayList<>();
        ComMngStructAreaCityVO comMngStructAreaCityVO = new ComMngStructAreaCityVO();
        comMngStructAreaCityVO.setCityAdcode(510400);
        comMngStructAreaCityVO.setCityName("攀枝花市");
        comMngStructAreaCityVO.setId(256L);
        comMngStructAreaCityVO.setProvinceAdcode(510000);
        comMngStructAreaCityVO.setProvinceId(23L);
        List<ComMngStructAreaDistrictDO> comMngStructAreaDistrictDOS =
            comMngStructAreaDistrictDAO.selectList(new QueryWrapper<ComMngStructAreaDistrictDO>().lambda()
                .eq(ComMngStructAreaDistrictDO::getCityAdcode, cityAdcode));
        List<ComMngStructAreaDistrictVO> comMngStructAreaDistrictVOS = new ArrayList<>();
        if (!ObjectUtils.isEmpty(comMngStructAreaDistrictDOS)) {
            comMngStructAreaDistrictDOS.forEach(comMngStructAreaDistrictDO -> {
                ComMngStructAreaDistrictVO comMngStructAreaDistrictVO = new ComMngStructAreaDistrictVO();
                BeanUtils.copyProperties(comMngStructAreaDistrictDO, comMngStructAreaDistrictVO);
                comMngStructAreaDistrictVOS.add(comMngStructAreaDistrictVO);
            });
        }
        comMngStructAreaCityVO.setComMngStructAreaDistrictVOS(comMngStructAreaDistrictVOS);
        comMngStructAreaCityVOS.add(comMngStructAreaCityVO);
        comMngStructAreaProvinceVO.setComMngStructAreaCityVOS(comMngStructAreaCityVOS);
        comMngStructAreaProvinceVOS.add(comMngStructAreaProvinceVO);
        return R.ok(comMngStructAreaDistrictVOS);
    }
 
}