From 4c391aa12cdb8e32d194cfc70096c6a5dea72893 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期五, 13 九月 2024 09:26:54 +0800
Subject: [PATCH] 优化代码 指定时间段内用水量超过指定值的农户 指定时间段内消费金额超过指定值的农户 指定时间段内用水时长超过指定值的农户
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 33 ++++++++++++++++++++++++++++++---
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java | 17 +++++++++++++++++
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java
index 81700c2..f4968aa 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java
@@ -50,4 +50,21 @@
* 寮�闃�娆℃暟
*/
private Integer openCount;
+
+ /**
+ * 鐢ㄦ按閲�
+ */
+ private Double waterConsumption;
+
+ /**
+ * 娑堣垂閲戦
+ */
+ private Double amountSpent;
+
+ /**
+ * 鐢ㄦ按鏃堕暱
+ */
+ private Double waterDuration;
+
+
}
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 bff8b95..cb816f9 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -748,7 +748,16 @@
cli.clientNum,
CONCAT(cli.districtTitle, cli.address) AS address,
cli.phone,
- cli.idCard
+ cli.idCard,
+ IFNULL((SELECT SUM(his.cl_this_amount)
+ FROM rm_open_close_valve_history his
+ <where>
+ his.client_id = cli.id
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ ),0) AS waterConsumption
FROM se_client cli
<where>
<if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterConsumption != null">
@@ -786,7 +795,16 @@
cli.clientNum,
CONCAT(cli.districtTitle, cli.address) AS address,
cli.phone,
- cli.idCard
+ cli.idCard,
+ IFNULL((SELECT SUM(his.cl_this_money)
+ FROM rm_open_close_valve_history his
+ <where>
+ his.client_id = cli.id
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ ),0) AS amountSpent
FROM se_client cli
<where>
<if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and amountSpent != null">
@@ -825,7 +843,16 @@
cli.clientNum,
CONCAT(cli.districtTitle, cli.address) AS address,
cli.phone,
- cli.idCard
+ cli.idCard,
+ IFNULL((SELECT SUM(his.cl_this_time)
+ FROM rm_open_close_valve_history his
+ <where>
+ his.client_id = cli.id
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ ),0) AS waterDuration
FROM se_client cli
<where>
<if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterDuration != null">
--
Gitblit v1.8.0