From 7adab86fc7f9767def711031716221f6144ef9ee Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期四, 25 七月 2024 17:41:30 +0800
Subject: [PATCH] 8个接口增加可以通过取水口ID或农户ID查询

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 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 69b434b..72263b5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmIntakeAmountDayMapper.xml
@@ -155,13 +155,65 @@
       rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍鎬绘暟-->
+  <select id="getRecordCount" resultType="java.lang.Long">
+    select count(*)
+    from rm_intake_amount_day riad
+    Left join pr_intake pint on pint.id = riad.intake_id
+    <where>
+      <if test="intakeName != null">
+        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
+      </if>
+      <if test="intakeId != null">
+        and rash.intake_id = #{intakeId}
+      </if>
+      <if test="startDt != null">
+        and riad.dt &gt;= #{startDt,jdbcType=DATE}
+      </if>
+      <if test="endDt != null">
+        and riad.dt &lt;= #{endDt,jdbcType=DATE}
+      </if>
+    </where>
+    </select>
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍-->
+  <select id="getIntakeAmountDayHistory" resultType="com.dy.pipIrrGlobal.voRm.VoIntakeAmountDay">
+    select
+    CAST(riad.intake_id AS char)AS intakeId,
+    pint.name as intakeName,
+    riad.dt as dt,
+    riad.amount as amount,
+    riad.dt_last as dtLast,
+    riad.rtu_addr_last as rtuAddrLast,
+    CAST(riad.controller_id_last AS char)AS controllerIdLast,
+    riad.total_amount_last as totalAmountLast,
+    riad.rtu_dt_last as rtuDtLast
+    from rm_intake_amount_day riad
+    Left join pr_intake pint on pint.id = riad.intake_id
+    <where>
+      <if test="intakeName != null">
+        and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%')
+      </if>
+      <if test="intakeId != null">
+        and rash.intake_id = #{intakeId}
+      </if>
+      <if test="startDt != null">
+        and riad.dt &gt;= #{startDt,jdbcType=DATE}
+      </if>
+      <if test="endDt != null">
+        and riad.dt &lt;= #{endDt,jdbcType=DATE}
+      </if>
+    </where>
+    ORDER BY riad.id DESC
+    <if test="pageCurr != null and pageSize != null">
+      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
+    </if>
+  </select>
 
 
   <select id="statisticsByIntake" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics">
-    select intake_id, sum(amount) as amount
+    select intake_id, sum(amount) amount
     from rm_intake_amount_day
-    where id <![CDATA[>=]]> #{startId,jdbcType=BIGINT} and id <![CDATA[<]]> #{endId,jdbcType=BIGINT}
+    where id <![CDATA[>=]]> #{startId, jdbcType=BIGINT} and id <![CDATA[<]]> #{endId, jdbcType=BIGINT}
     group by intake_id
   </select>
-
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0