From c8934e53e8477189927da76b51177808f21a6348 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 10 九月 2024 11:16:16 +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 |   60 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 18 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 20555a2..12007b5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -715,10 +715,14 @@
     <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}
+        <where>
+            <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterConsumption != null">
+                (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}
+            </if>
+        </where>
     </select>
 
     <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛-->
@@ -730,10 +734,14 @@
                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}
+        <where>
+            <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterConsumption != null">
+                (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}
+            </if>
+        </where>
         ORDER BY cli.id
         <trim prefix="limit ">
             <if test="start != null and count != null">
@@ -746,10 +754,14 @@
     <select id="getLargeAmountSpentClientsCount" resultType="java.lang.Long">
         SELECT COUNT(*) AS recordCount
         FROM se_client cli
-        WHERE (SELECT SUM(his.cl_this_money)
+        <where>
+        <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and amountSpent != null">
+               (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}
+        </if>
+        </where>
     </select>
     <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
     <select id="getLargeAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
@@ -760,10 +772,14 @@
                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}
+        <where>
+            <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and amountSpent != null">
+                (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}
+            </if>
+        </where>
         ORDER BY cli.id
         <trim prefix="limit ">
             <if test="start != null and count != null">
@@ -776,10 +792,14 @@
     <select id="getLargeWaterDurationClientsCount" resultType="java.lang.Long">
         SELECT COUNT(*) AS recordCount
         FROM se_client cli
-        WHERE (SELECT SUM(his.cl_this_time)
+        <where>
+        <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterDuration != null">
+               (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}
+        </if>
+        </where>
     </select>
 
     <!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
@@ -791,10 +811,14 @@
                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}
+        <where>
+            <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterDuration != null">
+                (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}
+            </if>
+        </where>
         ORDER BY cli.id
         <trim prefix="limit ">
             <if test="start != null and count != null">

--
Gitblit v1.8.0