|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | 
|---|
|  |  |  | @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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|