From e059d06932a35d26be1c030dce61964bd04a1488 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 09 一月 2025 16:41:35 +0800
Subject: [PATCH] 优化”最近未上报数据“功能实现

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml |   46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
index 7f1859a..c81dd42 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
@@ -423,36 +423,40 @@
     <!--鑾峰彇鏈�杩戞湭鎶ユ暟鐨勫彇姘村彛鏁伴噺-->
     <select id="getUnReportedIntakesCount" resultType="java.lang.Long">
         SELECT
-            count(*)
-        FROM  pr_intake pit
-        LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id
-        LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
-        WHERE  rohrl.id is NULL
+        count(*)
+        FROM pr_intake pit
+        LEFT JOIN `rm_on_hour_report_last` rohrl
+        ON (
+            pit.id = rohrl.intake_id
         <if test="timeStart != null and timeStart != '' ">
-            OR rohrl.rtu_dt  &lt; #{timeStart}
+            AND rohrl.dt  > #{timeStart}
         </if>
-<!--        <if test="timeStop != null and timeStop != '' ">-->
-<!--            OR rohrl.rtu_dt &gt; #{timeStop}-->
-<!--        </if>-->
-        ORDER BY rtu_dt ASC
+        )
+        LEFT JOIN ba_block bbl ON bbl.id = pit.blockId
+        LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
+        WHERE rohrl.id is NULL
     </select>
     <!--鑾峰彇鏈�杩戞湭鎶ユ暟鐨勫彇姘村彛-->
     <select id="getUnReportedIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeUnReported">
         SELECT
-            pit.`name` intakeNum,
-            pct.rtuAddr,
-            rohrl.rtu_dt rtuDt
+            pit.id      AS intakeId,
+            pit.`name`  AS intakeNum,
+            pit.lng     AS lng,
+            pit.lat     AS lat,
+            bbl.name    AS blockName,
+            pct.rtuAddr AS rtuAddr
         FROM  pr_intake pit
-        LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id
+        LEFT JOIN `rm_on_hour_report_last` rohrl
+        ON (
+            pit.id = rohrl.intake_id
+        <if test="timeStart != null and timeStart != '' ">
+            AND rohrl.dt  > #{timeStart}
+        </if>
+        )
+        LEFT JOIN ba_block bbl ON bbl.id = pit.blockId
         LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
         WHERE  rohrl.id is NULL
-        <if test="timeStart != null">
-            OR rohrl.rtu_dt  &lt; #{timeStart}
-        </if>
-<!--        <if test="timeStop != null">-->
-<!--            OR rohrl.rtu_dt &gt; #{timeStop}-->
-<!--        </if>-->
-        ORDER BY rtu_dt ASC
+        ORDER BY pit.id DESC
         <trim prefix="limit ">
             <if test="start != null and count != null">
                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}

--
Gitblit v1.8.0