From b4c6816d3016e26d908c55d3a194d972b998e952 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 08 一月 2025 14:42:30 +0800
Subject: [PATCH] 优化接口 水卡使用情况(充值、消费、余额)
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 109 +++++++++++++++---------------------------------------
1 files changed, 31 insertions(+), 78 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 f09df25..8156a0d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -1037,84 +1037,7 @@
</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 >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0
- GROUP BY inta.id
- HAVING IFNULL(SUM(rocvh.cl_this_amount),0) > #{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 >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0
- GROUP BY inta.id
- HAVING IFNULL(SUM(rocvh.cl_this_amount),0) > #{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 >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0
- GROUP BY inta.id
- HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{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 >= #{timeStart} AND rocvh.cl_dt <= #{timeStop} AND inta.deleted = 0
- GROUP BY inta.id
- HAVING IFNULL(SUM(rocvh.cl_this_money),0) > #{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
@@ -1367,4 +1290,34 @@
</if>
</trim>
</select>
+
+
+
+ <!-- /////////////////////////////////// -->
+ <!-- 缁熻鐩稿叧 -->
+ <!-- /////////////////////////////////// -->
+ <select id="statisticsByIc" resultType="com.dy.pipIrrGlobal.voSt.VoIcConsumeStatistics">
+ select ocvh.client_id as clientId,
+ cc.id as cardId,
+ sum(ocvh.cl_this_amount) as water,
+ sum(ocvh.cl_this_money) as amount,
+ sum(ocvh.cl_this_time) as duration,
+ 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}
+ group by ocvh.client_id, cc.id
+ </select>
+ <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics">
+ select client_id as clientId,
+ sum(cl_this_amount) as water,
+ sum(cl_this_money) as amount,
+ 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}
+ group by client_id
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0