cjl
2023-10-13 c191d6d093b52badf95da4b661a0a95f3178377d
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
package com.moral.api.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.entity.GovMonitorPoint;
import com.moral.api.mapper.GovMonitorPointMapper;
import com.moral.api.service.GovMonitorPointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.constant.Constants;
import com.moral.util.RegionCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author moral
 * @since 2021-09-10
 */
@Service
public class GovMonitorPointServiceImpl extends ServiceImpl<GovMonitorPointMapper, GovMonitorPoint> implements GovMonitorPointService {
 
    @Autowired(required = false)
    private GovMonitorPointMapper govMonitorPointMapper;
 
    @Override
    public List<GovMonitorPoint> getGovMonitorPointByRegionCode(int code) {
        String regionName = RegionCodeUtils.regionCodeConvertToName(code);
        QueryWrapper<GovMonitorPoint> wrapper_govMonitorPoint = new QueryWrapper<>();
        wrapper_govMonitorPoint.eq("is_delete",Constants.NOT_DELETE);
        switch (regionName){
            case "province_code":wrapper_govMonitorPoint.eq("province_code",code);
                break;
            case "city_code":wrapper_govMonitorPoint.eq("city_code",code);
                break;
            case "area_code":wrapper_govMonitorPoint.eq("area_code",code);
                break;
            default:
                break;
        }
        List<GovMonitorPoint> govMonitorPoints = new ArrayList<>();
        govMonitorPoints = govMonitorPointMapper.selectList(wrapper_govMonitorPoint);
        return govMonitorPoints;
    }
}