|
@@ -1,14 +1,20 @@
|
|
package com.huimv.cattle.service.impl;
|
|
package com.huimv.cattle.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
+import com.huimv.cattle.mapper.SysFarmMapper;
|
|
import com.huimv.cattle.pojo.PreventDetection;
|
|
import com.huimv.cattle.pojo.PreventDetection;
|
|
import com.huimv.cattle.mapper.PreventDetectionMapper;
|
|
import com.huimv.cattle.mapper.PreventDetectionMapper;
|
|
|
|
+import com.huimv.cattle.pojo.SysFarm;
|
|
import com.huimv.cattle.service.PreventDetectionService;
|
|
import com.huimv.cattle.service.PreventDetectionService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -23,12 +29,19 @@ public class PreventDetectionServiceImpl extends ServiceImpl<PreventDetectionMap
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PreventDetectionMapper preventDetectionMapper;
|
|
private PreventDetectionMapper preventDetectionMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysFarmMapper sysFarmMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<PreventDetection> getPreventDetectionScreen(String farmCode) {
|
|
public List<PreventDetection> getPreventDetectionScreen(String farmCode) {
|
|
|
|
+ List<String> farmCodes = Arrays.asList();
|
|
|
|
+ //没传farmId
|
|
if (StringUtils.isBlank(farmCode)){
|
|
if (StringUtils.isBlank(farmCode)){
|
|
- farmCode = "0";
|
|
|
|
|
|
+ List<SysFarm> sysFarms = sysFarmMapper.selectList(null);
|
|
|
|
+ farmCodes = sysFarms.stream().map(SysFarm::getFarmCode).collect(Collectors.toList());
|
|
}
|
|
}
|
|
- return preventDetectionMapper.getPreventDetectionScreen(farmCode);
|
|
|
|
|
|
+ QueryWrapper<PreventDetection> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.in("farm_code",farmCodes);
|
|
|
|
+ return preventDetectionMapper.getPreventDetectionScreen(wrapper);
|
|
}
|
|
}
|
|
}
|
|
}
|