From 2edf7dc27783594eb86b727a926f1d280ec561a7 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 07 八月 2024 15:51:44 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml |  209 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 209 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
index 2904017..f933ee8 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -786,4 +786,213 @@
             </if>
         </trim>
     </select>
+
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛鏁伴噺-->
+    <select id="getLargeWaterConsumptionClientsCount" resultType="java.lang.Long">
+        SELECT COUNT(*) AS recordCount
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_amount)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterConsumption}
+    </select>
+
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛-->
+    <select id="getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+        SELECT cli.id                                 AS clientId,
+               cli.name                               AS clientName,
+               cli.clientNum,
+               CONCAT(cli.districtTitle, cli.address) AS address,
+               cli.phone,
+               cli.idCard
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_amount)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterConsumption}
+        ORDER BY cli.id
+        <trim prefix="limit ">
+            <if test="start != null and count != null">
+                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+            </if>
+        </trim>
+    </select>
+
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
+    <select id="getLargeAmountSpentClientsCount" resultType="java.lang.Long">
+        SELECT COUNT(*) AS recordCount
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_money)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{amountSpent}
+    </select>
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
+    <select id="getLargeAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+        SELECT cli.id                                 AS clientId,
+               cli.name                               AS clientName,
+               cli.clientNum,
+               CONCAT(cli.districtTitle, cli.address) AS address,
+               cli.phone,
+               cli.idCard
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_money)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{amountSpent}
+        ORDER BY cli.id
+        <trim prefix="limit ">
+            <if test="start != null and count != null">
+                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+            </if>
+        </trim>
+    </select>
+
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
+    <select id="getLargeWaterDurationClientsCount" resultType="java.lang.Long">
+        SELECT COUNT(*) AS recordCount
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_time)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterDuration}
+    </select>
+
+    <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
+    <select id="getLargeWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+        SELECT cli.id                                 AS clientId,
+               cli.name                               AS clientName,
+               cli.clientNum,
+               CONCAT(cli.districtTitle, cli.address) AS address,
+               cli.phone,
+               cli.idCard
+        FROM se_client cli
+        WHERE (SELECT SUM(his.cl_this_time)
+               FROM rm_open_close_valve_history his
+               WHERE his.client_id = cli.id
+                 AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{waterDuration}
+        ORDER BY cli.id
+        <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="getUseWaterGtValueIntakesCount" resultType="java.lang.Long">
+        select
+            count(*)
+        from
+            (        SELECT
+        inta.id AS intakeId,
+        inta.NAME AS intakeNum,
+        blo.NAME AS blockName ,
+        IFNULL(SUM(rocvh.cl_this_amount),0) AS value
+        FROM
+        pr_intake inta
+        INNER JOIN ba_block blo ON blo.id = inta.blockId
+        LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_amount),0) &gt; #{value}) 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(SUM(rocvh.cl_this_amount),0) AS value
+        FROM
+            pr_intake inta
+            INNER JOIN ba_block blo ON blo.id = inta.blockId
+            LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_amount),0) &gt; #{value}
+        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>
+    <!--鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙g殑鏁伴噺-->
+    <select id="getExpenseGtValueIntakesCount" resultType="java.lang.Long">
+        select
+        count(*)
+        from
+        (        SELECT
+        inta.id AS intakeId,
+        inta.NAME AS intakeNum,
+        blo.NAME AS blockName ,
+        IFNULL(SUM(rocvh.cl_this_money),0) AS value
+        FROM
+        pr_intake inta
+        INNER JOIN ba_block blo ON blo.id = inta.blockId
+        LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_money),0) &gt; #{value}) c
+    </select>
+    <!--鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+    <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
+        SELECT
+        inta.id AS intakeId,
+        inta.NAME AS intakeNum,
+        blo.NAME AS blockName ,
+        IFNULL(SUM(rocvh.cl_this_money),0) AS value
+        FROM
+        pr_intake inta
+        INNER JOIN ba_block blo ON blo.id = inta.blockId
+        LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_money),0) &gt; #{value}
+        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>
+    <!--鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�-->
+    <select id="getUseWaterDurationGtValueIntakesCount" resultType="java.lang.Long">
+        select
+        count(*)
+        from
+        (        SELECT
+        inta.id AS intakeId,
+        inta.NAME AS intakeNum,
+        blo.NAME AS blockName ,
+        IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount
+        FROM
+        pr_intake inta
+        INNER JOIN ba_block blo ON blo.id = inta.blockId
+        LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_time),0) &gt; #{value}) c
+    </select>
+    <!--鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+    <select id="getUseWaterDurationGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount">
+        SELECT
+        inta.id AS intakeId,
+        inta.NAME AS intakeNum,
+        blo.NAME AS blockName ,
+        IFNULL(SUM(rocvh.cl_this_time),0) AS recordCount
+        FROM
+        pr_intake inta
+        INNER JOIN ba_block blo ON blo.id = inta.blockId
+        LEFT JOIN rm_open_close_valve_history rocvh ON rocvh.intake_id = inta.id
+        WHERE rocvh.op_dt &gt;= #{timeStart} AND rocvh.cl_dt &lt;= #{timeStop} AND inta.deleted = 0
+        GROUP BY inta.id
+        HAVING IFNULL(SUM(rocvh.cl_this_time),0) &gt; #{value}
+        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