From 0a9628c6c5880d4eed055d50e6e8083a2e5a8637 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期二, 06 八月 2024 15:48:46 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml |   70 +++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
index 461c263..c3afb26 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
@@ -283,7 +283,71 @@
       </if>
     </trim>
   </select>
-
-
-
+  <!--鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍙栨按鍙f暟閲�-->
+  <select id="getUseWaterGtValueIntakesCount" resultType="java.lang.Long">
+    select
+    count(*)
+    from
+    (
+    SELECT
+    inta.id AS intakeId,
+    inta.NAME AS intakeNum,
+    blo.NAME AS blockName ,
+    IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) AS value
+    FROM
+    pr_intake inta
+    INNER JOIN ba_block blo ON blo.id = inta.blockId
+    LEFT JOIN (SELECT
+    intake_id,
+    total_amount
+    FROM
+    rm_on_hour_report_history rohrs
+    WHERE rohrs.rtu_dt = (	 SELECT MAX(rtu_dt)
+    FROM rm_on_hour_report_history
+    WHERE rtu_dt &lt;= #{timeStart})) AS a ON inta.id = a.intake_id
+    LEFT JOIN (	 SELECT
+    intake_id,
+    total_amount
+    FROM
+    rm_on_hour_report_history rohrs
+    WHERE rohrs.rtu_dt = (	 SELECT MAX(rtu_dt)
+    FROM rm_on_hour_report_history
+    WHERE rtu_dt &lt;= #{timeStop})) AS b ON inta.id = b.intake_id
+    WHERE IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) &gt; #{value} AND inta.deleted = 0
+    ) c
+    </select>
+  <!--鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍙栨按鍙�-->
+  <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
+    SELECT
+      inta.id AS intakeId,
+      inta.NAME AS intakeNum,
+      blo.NAME AS blockName ,
+      IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) AS value
+    FROM
+      pr_intake inta
+      INNER JOIN ba_block blo ON blo.id = inta.blockId
+      LEFT JOIN (SELECT
+      intake_id,
+      total_amount
+      FROM
+      rm_on_hour_report_history rohrs
+      WHERE rohrs.rtu_dt = (	 SELECT MAX(rtu_dt)
+      FROM rm_on_hour_report_history
+      WHERE rtu_dt &lt;= #{timeStart})) AS a ON inta.id = a.intake_id
+    LEFT JOIN (	 SELECT
+    intake_id,
+    total_amount
+    FROM
+    rm_on_hour_report_history rohrs
+    WHERE rohrs.rtu_dt = (	 SELECT MAX(rtu_dt)
+    FROM rm_on_hour_report_history
+    WHERE rtu_dt &lt;= #{timeStop})) AS b ON inta.id = b.intake_id
+    WHERE IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) &gt; #{value} AND inta.deleted = 0
+    ORDER BY inta.id
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
+  </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0