|
@@ -151,19 +151,18 @@ public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoMapper, Warni
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<WarningInfo> listWarningByType(WarningInfoWarningTypeParam warningTypeParam) {
|
|
|
+ public Page<WarningInfo> listWarningByType(WarningInfoWarningTypeParam warningTypeParam) {
|
|
|
String type = warningTypeParam.getType();
|
|
|
String orgId = warningTypeParam.getOrgId();
|
|
|
- Integer num = warningTypeParam.getNum();
|
|
|
+ Integer current = warningTypeParam.getCurrent();
|
|
|
+ Integer size = warningTypeParam.getSize();
|
|
|
+ Page<WarningInfo> page = new Page<>(current,size);
|
|
|
String warningType;
|
|
|
- List<WarningInfo> warningInfos = new ArrayList<>();
|
|
|
+ Page<WarningInfo> warningInfos = new Page<>();
|
|
|
QueryWrapper<WarningInfo> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.lambda().eq(WarningInfo::getOrgId,orgId).orderByDesc(WarningInfo::getWarningTime);
|
|
|
- if (ObjectUtil.isNotEmpty(num)){
|
|
|
- queryWrapper.lambda().last("limit"+num);
|
|
|
- }
|
|
|
+ queryWrapper.lambda().ge(WarningInfo::getWarningTime,DateUtil.beginOfDay(new Date())).eq(WarningInfo::getWarningStatus,0).eq(WarningInfo::getOrgId,orgId).orderByDesc(WarningInfo::getWarningTime);
|
|
|
Map<String, String> typeToConfigNameMapping = new HashMap<>();
|
|
|
- typeToConfigNameMapping.put("1", "环境预警");
|
|
|
+ typeToConfigNameMapping.put("1", "环控预警");
|
|
|
typeToConfigNameMapping.put("2", "能耗预警");
|
|
|
typeToConfigNameMapping.put("3", "巡检预警");
|
|
|
typeToConfigNameMapping.put("4", "洗消预警");
|
|
@@ -175,10 +174,10 @@ public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoMapper, Warni
|
|
|
String configName = typeToConfigNameMapping.get(type);
|
|
|
// 通过查询数据库获取对应的warningType值
|
|
|
warningType = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getConfigName, configName)).getId();
|
|
|
- queryWrapper.lambda().eq(WarningInfo::getWarningType,warningType);
|
|
|
- warningInfos = this.list(queryWrapper);
|
|
|
+ queryWrapper.lambda().eq(WarningInfo::getWarningTypeId,warningType);
|
|
|
+ warningInfos = this.page(page,queryWrapper);
|
|
|
}else if ("0".equals(type)){
|
|
|
- warningInfos = this.list(queryWrapper);
|
|
|
+ warningInfos = this.page(page,queryWrapper);
|
|
|
}else {
|
|
|
throw new CommonException("参数范围错误!");
|
|
|
}
|