Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Kazerin 1 день назад
Родитель
Сommit
563fd56b87

+ 16 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/mapper/EquipmentPointRelMapper.java

@@ -3,7 +3,23 @@ package com.zksy.base.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zksy.base.domain.EquipmentPointRel;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface EquipmentPointRelMapper extends BaseMapper<EquipmentPointRel> {
+
+    /**
+     * 根据设备ID联表查询关联的监测点信息(point_code / point_name 等)
+     */
+    @Select("SELECT t1.rel_id AS relId, t1.equipment_id AS equipmentId, t1.point_id AS pointId, "
+            + "t2.point_code AS pointCode, t2.point_name AS pointName, t1.create_time AS createTime "
+            + "FROM equipment_point_rel t1 "
+            + "INNER JOIN monitor_point t2 ON t1.point_id = t2.point_id "
+            + "WHERE t1.equipment_id = #{equipmentId} "
+            + "AND t1.del_flag = '0' AND t2.del_flag = '0'")
+    List<Map<String, Object>> selectPointRelByEquipmentId(@Param("equipmentId") String equipmentId);
 }

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

@@ -849,10 +849,9 @@ public class EquipmentBaseServiceImpl extends ServiceImpl<EquipmentBaseMapper, E
         List<EquipmentMaintain> maintainList = equipmentMaintainMapper.selectList(maintainWrapper);
         result.put("maintainList", maintainList);
 
-        LambdaQueryWrapper<EquipmentPointRel> relWrapper = new LambdaQueryWrapper<>();
-        relWrapper.eq(EquipmentPointRel::getEquipmentId, equipmentId);
-        List<EquipmentPointRel> relList = equipmentPointRelMapper.selectList(relWrapper);
-        result.put("pointRelList", relList);
+        // 联表查询设备关联的监测点(含 point_code / point_name)
+        List<Map<String, Object>> pointRelList = equipmentPointRelMapper.selectPointRelByEquipmentId(equipmentId);
+        result.put("pointRelList", pointRelList);
 
         // 现在 WarningThreshold 有了 equipmentId 字段,直接匹配
         LambdaQueryWrapper<WarningThreshold> thresholdWrapper = new LambdaQueryWrapper<>();