huanghongfa
2021-01-27 083274723aca1abeebaea486c90fd4e10f891b1b
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
package com.panzhihua.service_community.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngStructAreaDistrictVO;
import com.panzhihua.service_community.dao.ComMngStructAreaDistrictDAO;
import com.panzhihua.service_community.model.dos.ComMngStructAreaDistrictDO;
import com.panzhihua.service_community.service.ComMngStructAreaDistrictService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @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<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);
            });
        }
        return R.ok(comMngStructAreaDistrictVOS);
    }
}