|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.huimv.common.exception.RRException;
|
|
|
import com.huimv.management.dao.FarmDao;
|
|
|
import com.huimv.management.dao.PigstyDao;
|
|
|
import com.huimv.management.entity.FarmEntity;
|
|
@@ -55,25 +56,40 @@ public class IndoorEnvironmentServiceImpl extends ServiceImpl<IndoorEnvironmentD
|
|
|
queryWrapper.eq("env.abnormal_status", Boolean.parseBoolean(abnormalStatus));
|
|
|
}
|
|
|
|
|
|
- //牧场名称
|
|
|
- String farmName = (String) params.get("farmName");
|
|
|
- if (farmName != null) {
|
|
|
- LambdaQueryWrapper<FarmEntity> query = Wrappers.<FarmEntity>lambdaQuery().like(FarmEntity::getName, farmName);
|
|
|
- List<Integer> idList = farmDao.selectIdList(query);
|
|
|
- if (CollUtil.isNotEmpty(idList)) {
|
|
|
- queryWrapper.in("env.farm_id", idList);
|
|
|
- }
|
|
|
+ String farmId = (String) params.get("farmId");
|
|
|
+ if (StringUtils.isNotBlank(farmId)) {
|
|
|
+ queryWrapper.eq("env.farm_id",Integer.parseInt(farmId));
|
|
|
}
|
|
|
|
|
|
- //猪舍名称
|
|
|
- String pigstyName = (String) params.get("pigstyName");
|
|
|
- if (StringUtils.isNotEmpty(pigstyName)) {
|
|
|
- List<Integer> idList = pigstyDao.selectIdListByPigstyName(pigstyName);
|
|
|
- if (CollUtil.isNotEmpty(idList)) {
|
|
|
- queryWrapper.in("env.pigsty_id", idList);
|
|
|
+
|
|
|
+ String pigstyId = (String) params.get("pigstyId");
|
|
|
+ if (StringUtils.isNotBlank(pigstyId)) {
|
|
|
+ if (StringUtils.isBlank(farmId)) {
|
|
|
+ throw new RRException("请先选择要查询的牧场!");
|
|
|
}
|
|
|
+ int val = Integer.parseInt(pigstyId);
|
|
|
+ queryWrapper.eq("env.pigsty_id", val);
|
|
|
}
|
|
|
|
|
|
+ //牧场名称
|
|
|
+// String farmName = (String) params.get("farmName");
|
|
|
+// if (farmName != null) {
|
|
|
+// LambdaQueryWrapper<FarmEntity> query = Wrappers.<FarmEntity>lambdaQuery().like(FarmEntity::getName, farmName);
|
|
|
+// List<Integer> idList = farmDao.selectIdList(query);
|
|
|
+// if (CollUtil.isNotEmpty(idList)) {
|
|
|
+// queryWrapper.in("env.farm_id", idList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ //猪舍名称
|
|
|
+// String pigstyName = (String) params.get("pigstyName");
|
|
|
+// if (StringUtils.isNotEmpty(pigstyName)) {
|
|
|
+// List<Integer> idList = pigstyDao.selectIdListByPigstyName(pigstyName);
|
|
|
+// if (CollUtil.isNotEmpty(idList)) {
|
|
|
+// queryWrapper.in("env.pigsty_id", idList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
//时间区间(前)
|
|
|
String startTime = (String) params.get("startTime");
|
|
|
if (StringUtils.isNotEmpty(startTime)) {
|
|
@@ -83,7 +99,7 @@ public class IndoorEnvironmentServiceImpl extends ServiceImpl<IndoorEnvironmentD
|
|
|
//时间区间(后)
|
|
|
String endTime = (String) params.get("endTime");
|
|
|
if (StringUtils.isNotEmpty(endTime)) {
|
|
|
- queryWrapper.le("env.collect_time", startTime);
|
|
|
+ queryWrapper.le("env.collect_time", endTime);
|
|
|
}
|
|
|
|
|
|
//排除逻辑删除
|