From 6955a2c758385c6c2e0d14350a11bdbf4f99780b Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 06 八月 2025 14:02:43 +0800
Subject: [PATCH] 1、实现作物实体管理;2、实现计算参数管理。
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 450 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 421 insertions(+), 29 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 267a730..bf62b09 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -611,7 +611,7 @@
inta.name AS intakeNum,
blo.name AS blockName
FROM pr_intake inta
- LEFT JOIN (SELECT intake_id
+ INNER JOIN (SELECT intake_id
FROM rm_open_close_valve_history
WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd}
) his ON his.intake_id = inta.id
@@ -629,7 +629,7 @@
inta.lat AS lat,
blo.name AS blockName
FROM pr_intake inta
- LEFT JOIN(SELECT intake_id
+ INNER JOIN(SELECT intake_id
FROM rm_open_close_valve_history
WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd}
) his ON his.intake_id = inta.id
@@ -653,7 +653,7 @@
inta.name AS intakeNum,
blo.name AS blockName
FROM pr_intake inta
- LEFT JOIN (SELECT intake_id
+ INNER JOIN (SELECT intake_id
FROM rm_open_close_valve_history
WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd}
) his ON his.intake_id = inta.id
@@ -671,7 +671,7 @@
inta.lat AS lat,
blo.name AS blockName
FROM pr_intake inta
- LEFT JOIN(SELECT intake_id
+ INNER JOIN(SELECT intake_id
FROM rm_open_close_valve_history
WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd}
) his ON his.intake_id = inta.id
@@ -689,20 +689,69 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getLargeOpenCountClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, COUNT(*) AS openCount
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="openCount != null and openCount > 0">
+ having openCount > #{openCount}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeOpenCountClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
- <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null">
- (SELECT COUNT(*)
- FROM rm_open_close_valve_history his
- WHERE his.client_id = cli.id
- AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount}
+ (SELECT COUNT(*)
+ 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>
+ ) > #{openCount}
</where>
</select>
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
<select id="getLargeOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.openCount
+ FROM se_client cli
+ inner join (
+ SELECT client_id, COUNT(*) AS openCount
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="openCount != null and openCount > 0">
+ having openCount > #{openCount}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -714,17 +763,18 @@
<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}
+ AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}
</if>
</where>) AS openCount
FROM se_client cli
<where>
- <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null">
- (SELECT COUNT(*)
- FROM rm_open_close_valve_history his
- WHERE his.client_id = cli.id
- AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount}
+ (SELECT COUNT(*)
+ FROM rm_open_close_valve_history his
+ WHERE his.client_id = cli.id
+ <if test="timeStart != null and timeStart != '' and timeStop != null">
+ AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}
</if>
+ ) > #{openCount}
</where>
ORDER BY cli.id
<trim prefix="limit ">
@@ -736,20 +786,71 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getSmallOpenCountClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, COUNT(*) AS openCount
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="openCount != null and openCount > 0">
+ having openCount < #{openCount}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallOpenCountClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
- <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null">
- (SELECT COUNT(*)
- FROM rm_open_close_valve_history his
- WHERE his.client_id = cli.id
- AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) < #{openCount}
+ (SELECT COUNT(*)
+ 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>
+ <if test="openCount != null">
+ ) < #{openCount}
</if>
</where>
</select>
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴寮�闃�娆℃暟浣庝簬鎸囧畾鍊肩殑鍐滄埛-->
<select id="getSmallOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.openCount
+ FROM se_client cli
+ inner join (
+ SELECT client_id, COUNT(*) AS openCount
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="openCount != null and openCount > 0">
+ having openCount < #{openCount}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -766,11 +867,14 @@
</where>) AS openCount
FROM se_client cli
<where>
- <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null">
- (SELECT COUNT(*)
- FROM rm_open_close_valve_history his
- WHERE his.client_id = cli.id
- AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) < #{openCount}
+ (SELECT COUNT(*)
+ 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>
+ <if test="openCount != null">
+ < #{openCount}
</if>
</where>
ORDER BY cli.id
@@ -783,6 +887,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛鏁伴噺-->
<select id="getLargeWaterConsumptionClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_amount) AS waterConsumption
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterConsumption != null and waterConsumption > 0">
+ having waterConsumption > #{waterConsumption}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeWaterConsumptionClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -797,6 +919,36 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忚秴杩囨寚瀹氬�肩殑鍐滄埛-->
<select id="getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.waterConsumption
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_amount) AS waterConsumption
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterConsumption != null and waterConsumption > 0">
+ having waterConsumption > #{waterConsumption}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -831,6 +983,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忎綆浜庢寚瀹氬�肩殑鍐滄埛鏁伴噺-->
<select id="getSmallWaterConsumptionClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_amount) AS waterConsumption
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterConsumption != null and waterConsumption > 0">
+ having waterConsumption < #{waterConsumption}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallWaterConsumptionClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -845,6 +1015,36 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忎綆浜庢寚瀹氬�肩殑鍐滄埛-->
<select id="getSmallWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.waterConsumption
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_amount) AS waterConsumption
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterConsumption != null and waterConsumption > 0">
+ having waterConsumption < #{waterConsumption}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -879,6 +1079,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getLargeAmountSpentClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_money) AS amountSpent
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="amountSpent != null and amountSpent > 0">
+ having amountSpent > #{amountSpent}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeAmountSpentClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -892,6 +1110,36 @@
</select>
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
<select id="getLargeAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.amountSpent
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_money) AS amountSpent
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="amountSpent != null and amountSpent > 0">
+ having amountSpent > #{amountSpent}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -926,6 +1174,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦浣庝簬鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getSmallAmountSpentClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_money) AS amountSpent
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="amountSpent != null and amountSpent > 0">
+ having amountSpent < #{amountSpent}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallAmountSpentClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -939,6 +1205,36 @@
</select>
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦浣庝簬鎸囧畾鍊肩殑鍐滄埛-->
<select id="getSmallAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.amountSpent
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_money) AS amountSpent
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="amountSpent != null and amountSpent > 0">
+ having amountSpent < #{amountSpent}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallAmountSpentClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -973,6 +1269,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getLargeWaterDurationClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_time) AS waterDuration
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterDuration != null and waterDuration > 0">
+ having waterDuration > #{waterDuration}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeWaterDurationClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -987,6 +1301,36 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛-->
<select id="getLargeWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.waterDuration
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_time) AS waterDuration
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterDuration != null and waterDuration > 0">
+ having waterDuration > #{waterDuration}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getLargeWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -1021,6 +1365,24 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱浣庝簬鎸囧畾鍊肩殑鍐滄埛鏁伴噺-->
<select id="getSmallWaterDurationClientsCount" resultType="java.lang.Long">
+ SELECT COUNT(*)
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_time) AS waterDuration
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterDuration != null and waterDuration > 0">
+ having waterDuration < #{waterDuration}
+ </if>
+ ) as his on his.client_id = cli.id
+ </select>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallWaterDurationClientsCount" resultType="java.lang.Long">
SELECT COUNT(*) AS recordCount
FROM se_client cli
<where>
@@ -1035,6 +1397,36 @@
<!--鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱浣庝簬鎸囧畾鍊肩殑鍐滄埛-->
<select id="getSmallWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
+ SELECT cli.id AS clientId,
+ cli.name AS clientName,
+ cli.clientNum,
+ cli.address,
+ cli.phone,
+ cli.idCard,
+ his.waterDuration
+ FROM se_client cli
+ inner join (
+ SELECT client_id, SUM(cl_this_time) AS waterDuration
+ FROM rm_open_close_valve_history
+ <where>
+ <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
+ op_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ group by client_id
+ <if test="waterDuration != null and waterDuration > 0">
+ having waterDuration < #{waterDuration}
+ </if>
+ ) as his on his.client_id = cli.id
+ 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>
+ <!-- 2025-07-29 涓嬮潰SQL鏌ヨ澶參锛屽簾寮� -->
+ <select id="_getSmallWaterDurationClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
SELECT cli.id AS clientId,
cli.name AS clientName,
cli.clientNum,
@@ -1336,8 +1728,8 @@
count(ocvh.id) as times
from rm_open_close_valve_history ocvh
inner join se_client_card cc on CAST(cc.cardNum AS CHAR) = ocvh.cl_ic_card_no
- where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT}
- and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT}
+ where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP }
+ and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP}
group by ocvh.client_id, cc.id
</select>
<select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics">
@@ -1347,8 +1739,8 @@
sum(cl_this_time) as duration,
count(id) as times
from rm_open_close_valve_history
- where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT}
- and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT}
+ where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP}
+ and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP}
group by client_id
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0