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 |   65 ++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 29 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 8559512..c81dd42 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
@@ -285,11 +285,13 @@
 
     <!--鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
     <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
-        SELECT inta.id                                  AS intakeId,
-               inta.name                                AS intakeNum,
-               blo.name                                 AS blockName,
-               CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
-               hou.dt                                   AS getDate
+        SELECT inta.id            AS intakeId,
+               inta.name          AS intakeNum,
+               inta.lng           AS lng,
+               inta.lat           AS lat,
+               blo.name           AS blockName,
+               hou.total_amount   AS cumulativeFlow,
+               hou.dt             AS getDate
         FROM pr_intake inta
                  INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                  INNER JOIN ba_block blo ON blo.id = inta.blockId
@@ -317,10 +319,11 @@
     <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
         SELECT inta.id   AS intakeId,
                inta.name AS intakeNum,
+               inta.lng  AS lng,
+               inta.lat  AS lat,
                blo.name  AS blockName,
-        <!--    FORMAT(hou.total_amount,2) AS cumulativeFlow,-->
-        CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
-        hou.dt                                   AS getDate
+               hou.total_amount AS cumulativeFlow,
+               hou.dt    AS getDate
         FROM pr_intake inta
                  INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                  INNER JOIN ba_block blo ON blo.id = inta.blockId
@@ -420,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