15030600271
2023-10-23 f547761b4f461b9716a1d773f2d28fb843a7deb3
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
package com.thhy.engineering.modules.biz.engineering.service.impl;
 
import com.thhy.engineering.modules.biz.engineering.entity.CityPullDown;
import com.thhy.engineering.modules.biz.engineering.mapper.SysDictMapper;
import com.thhy.engineering.modules.biz.engineering.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class CityServiceImpl implements CityService {
 
    @Autowired
    private SysDictMapper sysDictMapper;
 
    @Override
    public List<CityPullDown> cityPull() {
        List<CityPullDown> cityPullDownList = sysDictMapper.queryCity(100000);
        city(cityPullDownList);
        return cityPullDownList;
    }
 
    public void city(List<CityPullDown> cityPullDownList){
        for(CityPullDown cityPullDown : cityPullDownList){
            List<CityPullDown> cityPullDowns = sysDictMapper.queryCity(cityPullDown.getId());
            if(cityPullDowns.size()>0){
                city(cityPullDowns);
                cityPullDown.setHasChild(true);
                cityPullDown.setChilds(cityPullDowns);
            }else{
                cityPullDown.setHasChild(false);
            }
        }
    }
}