From 2117c8c5584451ecec7232db2f185c211a68acdf Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期一, 26 八月 2024 15:26:50 +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 | 110 +++++++++++++++++++++++++++++--------------------------
1 files changed, 58 insertions(+), 52 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 edfd7d1..74589f4 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
@@ -283,61 +283,67 @@
</if>
</trim>
</select>
-
- <!--鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�-->
- <select id="getLargeFlowIntakesCount" resultType="java.lang.Long">
+ <!--鎸囧畾鏃堕棿娈靛唴绱Н娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�-->
+ <select id="getTotalFlowGtValueIntakesCount" resultType="java.lang.Long">
+ select
+ count(*)
+ from
+ (
SELECT
- COUNT(*) AS recordCount
- 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
- WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
- </select>
-
- <!--鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
- <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
+ 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 <= #{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 <= #{timeStop})) AS b ON inta.id = b.intake_id
+ WHERE IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) > #{value} AND inta.deleted = 0
+ ) c
+ </select>
+ <!--鎸囧畾鏃堕棿娈靛唴绱Н娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+ <select id="getTotalFlowGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
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
- 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
- WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
- ORDER BY hou.dt
- <trim prefix="limit " >
- <if test="start != null and count != null">
- #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
- </if>
- </trim>
- </select>
-
- <!--鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲�-->
- <select id="getSmallFlowIntakesCount" resultType="java.lang.Long">
- SELECT
- COUNT(*) AS recordCount
- 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
- WHERE inta.deleted = 0 AND hou.total_amount < #{totalAmount}
- </select>
-
- <!--鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙�-->
- <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
- SELECT
- inta.id AS intakeId,
- inta.name AS intakeNum,
- 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
- 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
- WHERE inta.deleted = 0 AND hou.total_amount < #{totalAmount}
- ORDER BY hou.dt
+ 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 <= #{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 <= #{timeStop})) AS b ON inta.id = b.intake_id
+ WHERE IFNULL(b.total_amount, 0)-IFNULL(a.total_amount, 0) > #{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}
--
Gitblit v1.8.0