规则列表接口完成

This commit is contained in:
杨晓东 2025-11-24 11:16:23 +08:00
parent 64350a6f49
commit 32bcd96d79
2 changed files with 12 additions and 4 deletions

View File

@ -70,7 +70,8 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService {
@Override
public int insertDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo) {
paramMapper.update(new LambdaUpdateWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, dryEquipmentInfo.getRuleCode())
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode()));
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode())
.set(DryParamThreshold::getIsEnabled,"1"));
dryEquipmentInfo.setCreateBy(SecurityUtils.getUsername());
dryEquipmentInfo.setCreateTime(DateUtils.getNowDate());
@ -85,8 +86,13 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService {
*/
@Override
public int updateDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo) {
LambdaUpdateWrapper<DryParamThreshold> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode())
.eq(DryParamThreshold::getIsEnabled,"1");
paramMapper.update(wrapper.set(DryParamThreshold::getIsEnabled, "0"));
paramMapper.update(new LambdaUpdateWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, dryEquipmentInfo.getRuleCode())
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode()));
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode())
.set(DryParamThreshold::getIsEnabled,"1"));
dryEquipmentInfo.setUpdateBy(SecurityUtils.getUsername());
dryEquipmentInfo.setUpdateTime(DateUtils.getNowDate());
@ -150,6 +156,7 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService {
List<ParamThresholdDTO> result = new ArrayList<>();
for (DryParamThreshold item : list) {
ParamThresholdDTO param = new ParamThresholdDTO();
param.ruleCode = item.getRuleCode();
param.ruleName = item.getRuleName();
result.add(param);
}

View File

@ -73,6 +73,7 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
String setTem = (equipment != null && StringUtils.isNotBlank(equipment.getRuleCode()))
? Optional.ofNullable(paramMapper.selectOne(
new LambdaQueryWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, equipment.getRuleCode())
.eq(DryParamThreshold::getIsEnabled,"1")
)).map(DryParamThreshold::getMaxValue).orElse(null)
: null;
EquipmentScreenDTO.DryingDTO dto = new EquipmentScreenDTO.DryingDTO();
@ -132,7 +133,7 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
private Map<String, List<EquipmentScreenDTO.ParamDTO>> getParamMap(List<String> equipmentCodes) {
// 批量查询设备的所有阈值规则
LambdaQueryWrapper<DryParamThreshold> paramWrapper = new LambdaQueryWrapper<>();
paramWrapper.in(DryParamThreshold::getEquipmentCode, equipmentCodes);
paramWrapper.in(DryParamThreshold::getEquipmentCode, equipmentCodes).eq(DryParamThreshold::getIsEnabled, "1");
List<DryParamThreshold> thresholdList = paramMapper.selectList(paramWrapper);
// 转换为ParamDTO并按设备号分组
@ -185,6 +186,7 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
String setTem = (equipment != null && StringUtils.isNotBlank(equipment.getRuleCode()))
? Optional.ofNullable(paramMapper.selectOne(
new LambdaQueryWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, equipment.getRuleCode())
.eq(DryParamThreshold::getIsEnabled,"1")
)).map(DryParamThreshold::getMaxValue).orElse(null)
: null;
EquipmentScreenDTO.DrynessDTO dto = new EquipmentScreenDTO.DrynessDTO();
@ -203,7 +205,6 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
String tempValue = paramData.getOrDefault("TEMP", ""); // 温度值
String dewValue = paramData.getOrDefault("DEW", ""); // 露点值
// 方案1如果DTO有单独的温度/露点字段直接赋值推荐
dto.setTempValue(tempValue);
dto.setDewValue(dewValue);