|
@@ -3,6 +3,7 @@ package com.huimv.cattle.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.huimv.cattle.mapper.SysFarmMapper;
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
|
import com.huimv.cattle.pojo.PreventDetection;
|
|
|
import com.huimv.cattle.mapper.PreventDetectionMapper;
|
|
|
import com.huimv.cattle.pojo.SysFarm;
|
|
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -27,9 +29,11 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class PreventDetectionServiceImpl extends ServiceImpl<PreventDetectionMapper, PreventDetection> implements PreventDetectionService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PreventDetectionMapper preventDetectionMapper;
|
|
|
@Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
+ @Resource
|
|
|
private SysFarmMapper sysFarmMapper;
|
|
|
|
|
|
@Override
|
|
@@ -46,4 +50,30 @@ public class PreventDetectionServiceImpl extends ServiceImpl<PreventDetectionMap
|
|
|
wrapper.in("farm_code",farmCodes);
|
|
|
return preventDetectionMapper.getPreventDetectionScreen(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PreventDetection> getVillagePreventDetectionScreen(String farmCode) {
|
|
|
+ List<String> subCityList = new ArrayList<>();
|
|
|
+ if (StringUtils.isBlank(farmCode)){
|
|
|
+ farmCode ="0";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(farmCode) ||"0".equals(farmCode)){
|
|
|
+ String[] city = sysRegionCounTownVillMapper.listSub(farmCode).split(",");
|
|
|
+ for (String s : city) {
|
|
|
+ String[] strings = sysRegionCounTownVillMapper.listSub(s).split(",");
|
|
|
+ for (String string : strings) {
|
|
|
+ subCityList.add(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] subCity = subCityList.toArray(new String[subCityList.size()]);
|
|
|
+ QueryWrapper<PreventDetection> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.in("farm_code",subCity);
|
|
|
+ return preventDetectionMapper.getPreventDetectionScreen(wrapper);
|
|
|
+ }else {
|
|
|
+ String[] city = sysRegionCounTownVillMapper.listSub(farmCode).split(",");
|
|
|
+ QueryWrapper<PreventDetection> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.in("farm_code",city);
|
|
|
+ return preventDetectionMapper.getPreventDetectionScreen(wrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|