From daa7c1b49bec0e07aa94ffedcb410ddeed2f4c61 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 21 一月 2025 10:26:19 +0800
Subject: [PATCH] 取水统合数据功能部分实现
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml | 148 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 144 insertions(+), 4 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
index 7ddc8ab..4f198b9 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
@@ -8,6 +8,8 @@
<result column="intake_id" jdbcType="BIGINT" property="intakeId"/>
<result column="dt" jdbcType="DATE" property="dt"/>
<result column="amount" jdbcType="DOUBLE" property="amount"/>
+ <result column="money" jdbcType="DOUBLE" property="money" />
+ <result column="times" jdbcType="INTEGER" property="times" />
<result column="dt_last" jdbcType="TIMESTAMP" property="dtLast"/>
<result column="rtu_addr_last" jdbcType="VARCHAR" property="rtuAddrLast"/>
<result column="controller_id_last" jdbcType="BIGINT" property="controllerIdLast"/>
@@ -19,7 +21,7 @@
id,
intake_id,
dt,
- amount,
+ amount, money, times,
dt_last,
rtu_addr_last,
controller_id_last,
@@ -49,11 +51,11 @@
<insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay">
<!--@mbg.generated-->
insert into rm_intake_amount_day (id, intake_id, dt,
- amount, dt_last,
+ amount, money, times, dt_last,
rtu_addr_last, controller_id_last, total_amount_last,
rtu_dt_last)
values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE},
- #{amount,jdbcType=DOUBLE}, #{dtLast,jdbcType=TIMESTAMP},
+ #{amount,jdbcType=DOUBLE}, #{money,jdbcType=DOUBLE}, #{times,jdbcType=INTEGER}, #{dtLast,jdbcType=TIMESTAMP},
#{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT},
#{rtuDtLast,jdbcType=TIMESTAMP})
</insert>
@@ -72,6 +74,12 @@
</if>
<if test="amount != null">
amount,
+ </if>
+ <if test="money != null">
+ money,
+ </if>
+ <if test="times != null">
+ times,
</if>
<if test="dtLast != null">
dt_last,
@@ -101,6 +109,12 @@
</if>
<if test="amount != null">
#{amount,jdbcType=DOUBLE},
+ </if>
+ <if test="money != null">
+ #{money,jdbcType=DOUBLE},
+ </if>
+ <if test="times != null">
+ #{times,jdbcType=INTEGER},
</if>
<if test="dtLast != null">
#{dtLast,jdbcType=TIMESTAMP},
@@ -132,6 +146,12 @@
<if test="amount != null">
amount = #{amount,jdbcType=DOUBLE},
</if>
+ <if test="money != null">
+ money = #{money,jdbcType=DOUBLE},
+ </if>
+ <if test="times != null">
+ times = #{times,jdbcType=INTEGER},
+ </if>
<if test="dtLast != null">
dt_last = #{dtLast,jdbcType=TIMESTAMP},
</if>
@@ -156,6 +176,8 @@
set intake_id = #{intakeId,jdbcType=BIGINT},
dt = #{dt,jdbcType=DATE},
amount = #{amount,jdbcType=DOUBLE},
+ money = #{money,jdbcType=DOUBLE},
+ times = #{times,jdbcType=INTEGER},
dt_last = #{dtLast,jdbcType=TIMESTAMP},
rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR},
controller_id_last = #{controllerIdLast,jdbcType=BIGINT},
@@ -189,6 +211,8 @@
pint.name as intakeName,
riad.dt as dt,
riad.amount as amount,
+ riad.money as money,
+ riad.times as times,
riad.dt_last as dtLast,
riad.rtu_addr_last as rtuAddrLast,
CAST(riad.controller_id_last AS char) AS controllerIdLast,
@@ -995,5 +1019,121 @@
) as tb31 on tb31.intakeId = inta.intakeId
</select>
-
+ <!--鎸囧畾鏃堕棿娈电敤姘撮噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�-->
+ <select id="getUseWaterGtValueIntakesCount" resultType="java.lang.Long">
+ select
+ count(*)
+ from (
+ SELECT
+ SUM(riad.amount) AS value
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING value > #{value}
+ ) c
+ </select>
+ <!--鎸囧畾鏃堕棿娈电敤姘撮噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+ <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
+ SELECT
+ inta.id AS intakeId,
+ inta.NAME AS intakeNum,
+ inta.lng AS lng,
+ inta.lat AS lat,
+ blo.NAME AS blockName ,
+ SUM(riad.amount) AS value
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING value > #{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
+ SUM(riad.money) AS value
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING value > #{value}
+ ) c
+ </select>
+ <!--鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+ <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
+ SELECT
+ inta.id AS intakeId,
+ inta.NAME AS intakeNum,
+ inta.lng AS lng,
+ inta.lat AS lat,
+ blo.NAME AS blockName ,
+ SUM(riad.money) AS value
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING value > #{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="getUseWaterTimesGtValueIntakesCount" resultType="java.lang.Long">
+ select
+ count(*)
+ from (
+ SELECT
+ SUM(riad.times) AS valueInt
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING valueInt > #{value}
+ ) c
+ </select>
+ <!--鎸囧畾鏃堕棿娈靛唴鍙栨按娆℃暟瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�-->
+ <select id="getUseWaterTimesGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount">
+ SELECT
+ inta.id AS intakeId,
+ inta.NAME AS intakeNum,
+ inta.lng AS lng,
+ inta.lat AS lat,
+ blo.NAME AS blockName ,
+ SUM(riad.times) AS valueInt
+ FROM
+ pr_intake inta
+ INNER JOIN ba_block blo ON blo.id = inta.blockId
+ INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id
+ WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop}
+ GROUP BY inta.id
+ HAVING valueInt > #{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>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0