Jelajahi Sumber

fix(equipment): 修复设备预警阈值查询逻辑

- 修改单个设备删除时的预警阈值查询条件从equipmentId改为deviceCode
- 注释掉批量删除设备时的预警阈值删除逻辑
- 修改单个设备查询时的预警阈值查询条件从equipmentId改为deviceCode
林仔 5 hari lalu
induk
melakukan
2354b20eaf

+ 6 - 6
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/EquipmentBaseServiceImpl.java

@@ -177,10 +177,10 @@ public class EquipmentBaseServiceImpl extends ServiceImpl<EquipmentBaseMapper, E
         log.info("已删除设备[{}]的监测点关联", equipmentId);
 
         // 现在 WarningThreshold 有了 equipmentId 字段,直接匹配
-        LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();
-        thresholdWrapper.eq(WarningThreshold::getEquipmentId, equipmentId);
+        /*LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();
+        thresholdWrapper.eq(WarningThreshold::getDeviceCode, equipment.getEquipmentCode());
         warningThresholdMapper.delete(thresholdWrapper);
-        log.info("已删除设备[{}]的预警阈值配置", equipmentId);
+        log.info("已删除设备[{}]的预警阈值配置", equipmentId);*/
 
         LambdaQueryWrapper<EquipmentTest> testWrapper = new LambdaQueryWrapper<>();
         testWrapper.eq(EquipmentTest::getEquipmentId, equipmentId);
@@ -228,10 +228,10 @@ public class EquipmentBaseServiceImpl extends ServiceImpl<EquipmentBaseMapper, E
         log.info("已批量删除{}条设备的监测点关联", existIds.size());
 
         // 现在 WarningThreshold 有了 equipmentId 字段,直接匹配
-        LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();
+        /*LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();
         thresholdWrapper.in(WarningThreshold::getEquipmentId, existIds);
         warningThresholdMapper.delete(thresholdWrapper);
-        log.info("已批量删除{}条设备的预警阈值配置", existIds.size());
+        log.info("已批量删除{}条设备的预警阈值配置", existIds.size());*/
 
         LambdaQueryWrapper<EquipmentTest> testWrapper = new LambdaQueryWrapper<>();
         testWrapper.in(EquipmentTest::getEquipmentId, existIds);
@@ -471,7 +471,7 @@ public class EquipmentBaseServiceImpl extends ServiceImpl<EquipmentBaseMapper, E
 
         // 现在 WarningThreshold 有了 equipmentId 字段,直接匹配
         LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();
-        thresholdWrapper.eq(WarningThreshold::getEquipmentId, equipmentId);
+        thresholdWrapper.eq(WarningThreshold::getDeviceCode, equipment.getEquipmentCode());
         List<WarningThreshold> thresholdList = warningThresholdMapper.selectList(thresholdWrapper);
         result.put("thresholdList", thresholdList);