Quellcode durchsuchen

防疫检测村汇总

Newspaper vor 2 Jahren
Ursprung
Commit
8b4eeb10c5

+ 3 - 1
huimv-cattle/src/main/java/com/huimv/cattle/controller/PreventDetectionController.java

@@ -85,7 +85,9 @@ public class PreventDetectionController {
         List<PreventDetection> list = new ArrayList<>();
         if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==2) {
             list = preventDetectionService.getPreventDetectionScreen(farmCode);
-        }else {
+        }else if (dataSource.getDsStatus() == 1 && dataSource.getViewType() == 3){
+            list = preventDetectionService.getVillagePreventDetectionScreen(farmCode);
+        } else {
             list = preventDetectionService.list(new QueryWrapper<PreventDetection>().eq("farm_code",farmCode).orderByDesc("year").orderByDesc("month"));
             if (ObjectUtil.isEmpty(list)){
                 return new Result(ResultCode.SUCCESS,new ArrayList<>());

+ 2 - 0
huimv-cattle/src/main/java/com/huimv/cattle/service/PreventDetectionService.java

@@ -16,4 +16,6 @@ import java.util.List;
 public interface PreventDetectionService extends IService<PreventDetection> {
 
     List<PreventDetection> getPreventDetectionScreen(String farmCode);
+
+    List<PreventDetection> getVillagePreventDetectionScreen(String farmCode);
 }

+ 31 - 1
huimv-cattle/src/main/java/com/huimv/cattle/service/impl/PreventDetectionServiceImpl.java

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