From 6fa8408c8133e8c9aee2bbcdec37bf95c20951c0 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 07 二月 2025 15:39:16 +0800
Subject: [PATCH] 涉嫌偷水功能增加查询条件用水时长,修改sql语句

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml
index cbbad3c..8b04ce5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml
@@ -504,7 +504,7 @@
         oh.op_ic_card_no        AS openIcNum,
         oh.op_ic_card_addr      AS openIcAddr,
         oh.open_dt              AS openTime,
-        oh.op_type              AS openType_,
+        oh.op_type              AS opType,
         oh.op_order_no          AS openOrderNo,
         oh.op_total_amount      AS openTotalAmount,
         oh.op_remain_money      AS openRemainMoney,
@@ -513,7 +513,7 @@
         oh.cl_ic_card_no        AS closeIcNum,
         oh.cl_ic_card_addr      AS closeIcAddr,
         oh.close_dt             AS closeTime,
-        oh.cl_type              AS closeType_,
+        oh.cl_type              AS clType,
         oh.cl_this_amount       AS closeThisAmount,
         oh.cl_this_time         AS thisTime,
         oh.cl_price             AS closePrice,
@@ -522,7 +522,7 @@
         oh.cl_total_amount      AS closeTotalAmount
         FROM rm_open_close_valve_last oh
         LEFT JOIN pr_intake inta ON inta.id = oh.intake_id
-        LEFT JOIN ba_client cl ON cl.id = oh.client_id
+        LEFT JOIN se_client cl ON cl.id = oh.client_id
         <where>
             <if test="intakeId != null and intakeId > 0">
                 AND oh.intake_id = #{intakeId}
@@ -552,31 +552,43 @@
     </select>
 
     <!--鏍规嵁寮�闃�鏂瑰紡鑾峰彇鎿嶄綔娆℃暟-->
-    <select id="getCountByOpenType" resultType="java.lang.Integer">
-        SELECT COUNT(*) AS recordCount
+    <select id="getCountByOpenType" resultType="com.dy.pipIrrGlobal.voSt.VoCountOfOpenType">
+        SELECT
+        COUNT(*) AS openTypeCount,
+        op_type AS openType
         FROM rm_open_close_valve_history
         <where>
+            <if test="idStart != nul">
+                id <![CDATA[>=]]> #{idStart}
+            </if>
+            <if test="idEnd != nul">
+                AND id <![CDATA[<=]]> #{idEnd}
+            </if>
             <if test="openType != null">
                 AND op_type = #{openType}
             </if>
-            <if test="timeStart != null and timeStop != null">
-                AND op_dt BETWEEN #{timeStart} AND #{timeStop}
-            </if>
         </where>
+        group by op_type
     </select>
 
     <!--鏍规嵁鍏抽榾鏂瑰紡鑾峰彇鎿嶄綔娆℃暟-->
-    <select id="getCountByCloseType" resultType="java.lang.Integer">
-        SELECT COUNT(*) AS recordCount
+    <select id="getCountByCloseType" resultType="com.dy.pipIrrGlobal.voSt.VoCountOfCloseType">
+        SELECT
+        COUNT(*) AS closeTypeCount,
+        cl_type AS closeType
         FROM rm_open_close_valve_history
         <where>
+            <if test="idStart != nul">
+                id <![CDATA[>=]]> #{idStart}
+            </if>
+            <if test="idEnd != nul">
+                AND id <![CDATA[<=]]> #{idEnd}
+            </if>
             <if test="closeType != null">
                 AND cl_type = #{closeType}
             </if>
-            <if test="timeStart != null and timeStop != null">
-                AND cl_dt BETWEEN #{timeStart} AND #{timeStop}
-            </if>
         </where>
+        group by cl_type
     </select>
 
     <!--涓烘寚瀹氾紙闃�鎺у櫒鍦板潃銆佹按鍗$紪鍙枫�佹棤鍏抽榾璁板綍锛夊紑鍏抽榾鏈�鏂拌褰曟坊鍔犲叧闃�鏃堕棿锛屼娇涔嬩笉鍦ㄦ湭鍏抽榾璁板綍涓樉绀�-->

--
Gitblit v1.8.0