From b8470f5e90d0aed22bf2c4bf9f5d2a13cd60b15f Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 30 十二月 2024 14:03:41 +0800
Subject: [PATCH] 1、统计模块实现农户日用水量纵转横转存,月、年用水量统计; 2、临时模块农户日用水量纵转横转存,月、年用水量统计;

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountMonthMapper.xml |  500 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 452 insertions(+), 48 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountMonthMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountMonthMapper.xml
index b511957..559fde2 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountMonthMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountMonthMapper.xml
@@ -7,13 +7,49 @@
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="client_id" jdbcType="BIGINT" property="clientId" />
     <result column="year" jdbcType="INTEGER" property="year" />
-    <result column="month" jdbcType="INTEGER" property="month" />
-    <result column="amount" jdbcType="FLOAT" property="amount" />
-    <result column="money" jdbcType="FLOAT" property="money" />
+    <result column="amount1" jdbcType="FLOAT" property="amount1" />
+    <result column="money1" jdbcType="FLOAT" property="money1" />
+    <result column="times1" jdbcType="INTEGER" property="times1" />
+    <result column="amount2" jdbcType="FLOAT" property="amount2" />
+    <result column="money2" jdbcType="FLOAT" property="money2" />
+    <result column="times2" jdbcType="INTEGER" property="times2" />
+    <result column="amount3" jdbcType="FLOAT" property="amount3" />
+    <result column="money3" jdbcType="FLOAT" property="money3" />
+    <result column="times3" jdbcType="INTEGER" property="times3" />
+    <result column="amount4" jdbcType="FLOAT" property="amount4" />
+    <result column="money4" jdbcType="FLOAT" property="money4" />
+    <result column="times4" jdbcType="INTEGER" property="times4" />
+    <result column="amount5" jdbcType="FLOAT" property="amount5" />
+    <result column="money5" jdbcType="FLOAT" property="money5" />
+    <result column="times5" jdbcType="INTEGER" property="times5" />
+    <result column="amount6" jdbcType="FLOAT" property="amount6" />
+    <result column="money6" jdbcType="FLOAT" property="money6" />
+    <result column="times6" jdbcType="INTEGER" property="times6" />
+    <result column="amount7" jdbcType="FLOAT" property="amount7" />
+    <result column="money7" jdbcType="FLOAT" property="money7" />
+    <result column="times7" jdbcType="INTEGER" property="times7" />
+    <result column="amount8" jdbcType="FLOAT" property="amount8" />
+    <result column="money8" jdbcType="FLOAT" property="money8" />
+    <result column="times8" jdbcType="INTEGER" property="times8" />
+    <result column="amount9" jdbcType="FLOAT" property="amount9" />
+    <result column="money9" jdbcType="FLOAT" property="money9" />
+    <result column="times9" jdbcType="INTEGER" property="times9" />
+    <result column="amount10" jdbcType="FLOAT" property="amount10" />
+    <result column="money10" jdbcType="FLOAT" property="money10" />
+    <result column="times10" jdbcType="INTEGER" property="times10" />
+    <result column="amount11" jdbcType="FLOAT" property="amount11" />
+    <result column="money11" jdbcType="FLOAT" property="money11" />
+    <result column="times11" jdbcType="INTEGER" property="times11" />
+    <result column="amount12" jdbcType="FLOAT" property="amount12" />
+    <result column="money12" jdbcType="FLOAT" property="money12" />
+    <result column="times12" jdbcType="INTEGER" property="times12" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, client_id, `year`, `month`, amount, money
+    id, client_id, `year`, amount1, money1, times1, amount2, money2, times2, amount3, 
+    money3, times3, amount4, money4, times4, amount5, money5, times5, amount6, money6, 
+    times6, amount7, money7, times7, amount8, money8, times8, amount9, money9, times9, 
+    amount10, money10, times10, amount11, money11, times11, amount12, money12, times12
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -21,22 +57,6 @@
     <include refid="Base_Column_List" />
     from st_client_amount_month
     where id = #{id,jdbcType=BIGINT}
-  </select>
-  <select id="selectByClientIdAndYearAndMonth" resultMap="BaseResultMap">
-    select
-    <include refid="Base_Column_List" />
-    from st_client_amount_month
-    <where>
-      <if test="clientId != null">
-        and client_id = #{clientId,jdbcType=BIGINT}
-      </if>
-      <if test="year != null">
-        and year = #{year,jdbcType=INTEGER}
-      </if>
-      <if test="month != null">
-        and month = #{month,jdbcType=INTEGER}
-      </if>
-    </where>
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
@@ -46,9 +66,33 @@
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSt.StClientAmountMonth">
     <!--@mbg.generated-->
     insert into st_client_amount_month (id, client_id, `year`, 
-      `month`, amount, money)
+      amount1, money1, times1, 
+      amount2, money2, times2, 
+      amount3, money3, times3, 
+      amount4, money4, times4, 
+      amount5, money5, times5, 
+      amount6, money6, times6, 
+      amount7, money7, times7, 
+      amount8, money8, times8, 
+      amount9, money9, times9, 
+      amount10, money10, times10, 
+      amount11, money11, times11, 
+      amount12, money12, times12
+      )
     values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{year,jdbcType=INTEGER}, 
-      #{month,jdbcType=INTEGER}, #{amount,jdbcType=FLOAT}, #{money,jdbcType=FLOAT})
+      #{amount1,jdbcType=FLOAT}, #{money1,jdbcType=FLOAT}, #{times1,jdbcType=INTEGER}, 
+      #{amount2,jdbcType=FLOAT}, #{money2,jdbcType=FLOAT}, #{times2,jdbcType=INTEGER}, 
+      #{amount3,jdbcType=FLOAT}, #{money3,jdbcType=FLOAT}, #{times3,jdbcType=INTEGER}, 
+      #{amount4,jdbcType=FLOAT}, #{money4,jdbcType=FLOAT}, #{times4,jdbcType=INTEGER}, 
+      #{amount5,jdbcType=FLOAT}, #{money5,jdbcType=FLOAT}, #{times5,jdbcType=INTEGER}, 
+      #{amount6,jdbcType=FLOAT}, #{money6,jdbcType=FLOAT}, #{times6,jdbcType=INTEGER}, 
+      #{amount7,jdbcType=FLOAT}, #{money7,jdbcType=FLOAT}, #{times7,jdbcType=INTEGER}, 
+      #{amount8,jdbcType=FLOAT}, #{money8,jdbcType=FLOAT}, #{times8,jdbcType=INTEGER}, 
+      #{amount9,jdbcType=FLOAT}, #{money9,jdbcType=FLOAT}, #{times9,jdbcType=INTEGER}, 
+      #{amount10,jdbcType=FLOAT}, #{money10,jdbcType=FLOAT}, #{times10,jdbcType=INTEGER}, 
+      #{amount11,jdbcType=FLOAT}, #{money11,jdbcType=FLOAT}, #{times11,jdbcType=INTEGER}, 
+      #{amount12,jdbcType=FLOAT}, #{money12,jdbcType=FLOAT}, #{times12,jdbcType=INTEGER}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSt.StClientAmountMonth">
     <!--@mbg.generated-->
@@ -63,14 +107,113 @@
       <if test="year != null">
         `year`,
       </if>
-      <if test="month != null">
-        `month`,
+      <if test="amount1 != null">
+        amount1,
       </if>
-      <if test="amount != null">
-        amount,
+      <if test="money1 != null">
+        money1,
       </if>
-      <if test="money != null">
-        money,
+      <if test="times1 != null">
+        times1,
+      </if>
+      <if test="amount2 != null">
+        amount2,
+      </if>
+      <if test="money2 != null">
+        money2,
+      </if>
+      <if test="times2 != null">
+        times2,
+      </if>
+      <if test="amount3 != null">
+        amount3,
+      </if>
+      <if test="money3 != null">
+        money3,
+      </if>
+      <if test="times3 != null">
+        times3,
+      </if>
+      <if test="amount4 != null">
+        amount4,
+      </if>
+      <if test="money4 != null">
+        money4,
+      </if>
+      <if test="times4 != null">
+        times4,
+      </if>
+      <if test="amount5 != null">
+        amount5,
+      </if>
+      <if test="money5 != null">
+        money5,
+      </if>
+      <if test="times5 != null">
+        times5,
+      </if>
+      <if test="amount6 != null">
+        amount6,
+      </if>
+      <if test="money6 != null">
+        money6,
+      </if>
+      <if test="times6 != null">
+        times6,
+      </if>
+      <if test="amount7 != null">
+        amount7,
+      </if>
+      <if test="money7 != null">
+        money7,
+      </if>
+      <if test="times7 != null">
+        times7,
+      </if>
+      <if test="amount8 != null">
+        amount8,
+      </if>
+      <if test="money8 != null">
+        money8,
+      </if>
+      <if test="times8 != null">
+        times8,
+      </if>
+      <if test="amount9 != null">
+        amount9,
+      </if>
+      <if test="money9 != null">
+        money9,
+      </if>
+      <if test="times9 != null">
+        times9,
+      </if>
+      <if test="amount10 != null">
+        amount10,
+      </if>
+      <if test="money10 != null">
+        money10,
+      </if>
+      <if test="times10 != null">
+        times10,
+      </if>
+      <if test="amount11 != null">
+        amount11,
+      </if>
+      <if test="money11 != null">
+        money11,
+      </if>
+      <if test="times11 != null">
+        times11,
+      </if>
+      <if test="amount12 != null">
+        amount12,
+      </if>
+      <if test="money12 != null">
+        money12,
+      </if>
+      <if test="times12 != null">
+        times12,
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -83,14 +226,113 @@
       <if test="year != null">
         #{year,jdbcType=INTEGER},
       </if>
-      <if test="month != null">
-        #{month,jdbcType=INTEGER},
+      <if test="amount1 != null">
+        #{amount1,jdbcType=FLOAT},
       </if>
-      <if test="amount != null">
-        #{amount,jdbcType=FLOAT},
+      <if test="money1 != null">
+        #{money1,jdbcType=FLOAT},
       </if>
-      <if test="money != null">
-        #{money,jdbcType=FLOAT},
+      <if test="times1 != null">
+        #{times1,jdbcType=INTEGER},
+      </if>
+      <if test="amount2 != null">
+        #{amount2,jdbcType=FLOAT},
+      </if>
+      <if test="money2 != null">
+        #{money2,jdbcType=FLOAT},
+      </if>
+      <if test="times2 != null">
+        #{times2,jdbcType=INTEGER},
+      </if>
+      <if test="amount3 != null">
+        #{amount3,jdbcType=FLOAT},
+      </if>
+      <if test="money3 != null">
+        #{money3,jdbcType=FLOAT},
+      </if>
+      <if test="times3 != null">
+        #{times3,jdbcType=INTEGER},
+      </if>
+      <if test="amount4 != null">
+        #{amount4,jdbcType=FLOAT},
+      </if>
+      <if test="money4 != null">
+        #{money4,jdbcType=FLOAT},
+      </if>
+      <if test="times4 != null">
+        #{times4,jdbcType=INTEGER},
+      </if>
+      <if test="amount5 != null">
+        #{amount5,jdbcType=FLOAT},
+      </if>
+      <if test="money5 != null">
+        #{money5,jdbcType=FLOAT},
+      </if>
+      <if test="times5 != null">
+        #{times5,jdbcType=INTEGER},
+      </if>
+      <if test="amount6 != null">
+        #{amount6,jdbcType=FLOAT},
+      </if>
+      <if test="money6 != null">
+        #{money6,jdbcType=FLOAT},
+      </if>
+      <if test="times6 != null">
+        #{times6,jdbcType=INTEGER},
+      </if>
+      <if test="amount7 != null">
+        #{amount7,jdbcType=FLOAT},
+      </if>
+      <if test="money7 != null">
+        #{money7,jdbcType=FLOAT},
+      </if>
+      <if test="times7 != null">
+        #{times7,jdbcType=INTEGER},
+      </if>
+      <if test="amount8 != null">
+        #{amount8,jdbcType=FLOAT},
+      </if>
+      <if test="money8 != null">
+        #{money8,jdbcType=FLOAT},
+      </if>
+      <if test="times8 != null">
+        #{times8,jdbcType=INTEGER},
+      </if>
+      <if test="amount9 != null">
+        #{amount9,jdbcType=FLOAT},
+      </if>
+      <if test="money9 != null">
+        #{money9,jdbcType=FLOAT},
+      </if>
+      <if test="times9 != null">
+        #{times9,jdbcType=INTEGER},
+      </if>
+      <if test="amount10 != null">
+        #{amount10,jdbcType=FLOAT},
+      </if>
+      <if test="money10 != null">
+        #{money10,jdbcType=FLOAT},
+      </if>
+      <if test="times10 != null">
+        #{times10,jdbcType=INTEGER},
+      </if>
+      <if test="amount11 != null">
+        #{amount11,jdbcType=FLOAT},
+      </if>
+      <if test="money11 != null">
+        #{money11,jdbcType=FLOAT},
+      </if>
+      <if test="times11 != null">
+        #{times11,jdbcType=INTEGER},
+      </if>
+      <if test="amount12 != null">
+        #{amount12,jdbcType=FLOAT},
+      </if>
+      <if test="money12 != null">
+        #{money12,jdbcType=FLOAT},
+      </if>
+      <if test="times12 != null">
+        #{times12,jdbcType=INTEGER},
       </if>
     </trim>
   </insert>
@@ -104,14 +346,113 @@
       <if test="year != null">
         `year` = #{year,jdbcType=INTEGER},
       </if>
-      <if test="month != null">
-        `month` = #{month,jdbcType=INTEGER},
+      <if test="amount1 != null">
+        amount1 = #{amount1,jdbcType=FLOAT},
       </if>
-      <if test="amount != null">
-        amount = #{amount,jdbcType=FLOAT},
+      <if test="money1 != null">
+        money1 = #{money1,jdbcType=FLOAT},
       </if>
-      <if test="money != null">
-        money = #{money,jdbcType=FLOAT},
+      <if test="times1 != null">
+        times1 = #{times1,jdbcType=INTEGER},
+      </if>
+      <if test="amount2 != null">
+        amount2 = #{amount2,jdbcType=FLOAT},
+      </if>
+      <if test="money2 != null">
+        money2 = #{money2,jdbcType=FLOAT},
+      </if>
+      <if test="times2 != null">
+        times2 = #{times2,jdbcType=INTEGER},
+      </if>
+      <if test="amount3 != null">
+        amount3 = #{amount3,jdbcType=FLOAT},
+      </if>
+      <if test="money3 != null">
+        money3 = #{money3,jdbcType=FLOAT},
+      </if>
+      <if test="times3 != null">
+        times3 = #{times3,jdbcType=INTEGER},
+      </if>
+      <if test="amount4 != null">
+        amount4 = #{amount4,jdbcType=FLOAT},
+      </if>
+      <if test="money4 != null">
+        money4 = #{money4,jdbcType=FLOAT},
+      </if>
+      <if test="times4 != null">
+        times4 = #{times4,jdbcType=INTEGER},
+      </if>
+      <if test="amount5 != null">
+        amount5 = #{amount5,jdbcType=FLOAT},
+      </if>
+      <if test="money5 != null">
+        money5 = #{money5,jdbcType=FLOAT},
+      </if>
+      <if test="times5 != null">
+        times5 = #{times5,jdbcType=INTEGER},
+      </if>
+      <if test="amount6 != null">
+        amount6 = #{amount6,jdbcType=FLOAT},
+      </if>
+      <if test="money6 != null">
+        money6 = #{money6,jdbcType=FLOAT},
+      </if>
+      <if test="times6 != null">
+        times6 = #{times6,jdbcType=INTEGER},
+      </if>
+      <if test="amount7 != null">
+        amount7 = #{amount7,jdbcType=FLOAT},
+      </if>
+      <if test="money7 != null">
+        money7 = #{money7,jdbcType=FLOAT},
+      </if>
+      <if test="times7 != null">
+        times7 = #{times7,jdbcType=INTEGER},
+      </if>
+      <if test="amount8 != null">
+        amount8 = #{amount8,jdbcType=FLOAT},
+      </if>
+      <if test="money8 != null">
+        money8 = #{money8,jdbcType=FLOAT},
+      </if>
+      <if test="times8 != null">
+        times8 = #{times8,jdbcType=INTEGER},
+      </if>
+      <if test="amount9 != null">
+        amount9 = #{amount9,jdbcType=FLOAT},
+      </if>
+      <if test="money9 != null">
+        money9 = #{money9,jdbcType=FLOAT},
+      </if>
+      <if test="times9 != null">
+        times9 = #{times9,jdbcType=INTEGER},
+      </if>
+      <if test="amount10 != null">
+        amount10 = #{amount10,jdbcType=FLOAT},
+      </if>
+      <if test="money10 != null">
+        money10 = #{money10,jdbcType=FLOAT},
+      </if>
+      <if test="times10 != null">
+        times10 = #{times10,jdbcType=INTEGER},
+      </if>
+      <if test="amount11 != null">
+        amount11 = #{amount11,jdbcType=FLOAT},
+      </if>
+      <if test="money11 != null">
+        money11 = #{money11,jdbcType=FLOAT},
+      </if>
+      <if test="times11 != null">
+        times11 = #{times11,jdbcType=INTEGER},
+      </if>
+      <if test="amount12 != null">
+        amount12 = #{amount12,jdbcType=FLOAT},
+      </if>
+      <if test="money12 != null">
+        money12 = #{money12,jdbcType=FLOAT},
+      </if>
+      <if test="times12 != null">
+        times12 = #{times12,jdbcType=INTEGER},
       </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
@@ -121,18 +462,81 @@
     update st_client_amount_month
     set client_id = #{clientId,jdbcType=BIGINT},
       `year` = #{year,jdbcType=INTEGER},
-      `month` = #{month,jdbcType=INTEGER},
-      amount = #{amount,jdbcType=FLOAT},
-      money = #{money,jdbcType=FLOAT}
+      amount1 = #{amount1,jdbcType=FLOAT},
+      money1 = #{money1,jdbcType=FLOAT},
+      times1 = #{times1,jdbcType=INTEGER},
+      amount2 = #{amount2,jdbcType=FLOAT},
+      money2 = #{money2,jdbcType=FLOAT},
+      times2 = #{times2,jdbcType=INTEGER},
+      amount3 = #{amount3,jdbcType=FLOAT},
+      money3 = #{money3,jdbcType=FLOAT},
+      times3 = #{times3,jdbcType=INTEGER},
+      amount4 = #{amount4,jdbcType=FLOAT},
+      money4 = #{money4,jdbcType=FLOAT},
+      times4 = #{times4,jdbcType=INTEGER},
+      amount5 = #{amount5,jdbcType=FLOAT},
+      money5 = #{money5,jdbcType=FLOAT},
+      times5 = #{times5,jdbcType=INTEGER},
+      amount6 = #{amount6,jdbcType=FLOAT},
+      money6 = #{money6,jdbcType=FLOAT},
+      times6 = #{times6,jdbcType=INTEGER},
+      amount7 = #{amount7,jdbcType=FLOAT},
+      money7 = #{money7,jdbcType=FLOAT},
+      times7 = #{times7,jdbcType=INTEGER},
+      amount8 = #{amount8,jdbcType=FLOAT},
+      money8 = #{money8,jdbcType=FLOAT},
+      times8 = #{times8,jdbcType=INTEGER},
+      amount9 = #{amount9,jdbcType=FLOAT},
+      money9 = #{money9,jdbcType=FLOAT},
+      times9 = #{times9,jdbcType=INTEGER},
+      amount10 = #{amount10,jdbcType=FLOAT},
+      money10 = #{money10,jdbcType=FLOAT},
+      times10 = #{times10,jdbcType=INTEGER},
+      amount11 = #{amount11,jdbcType=FLOAT},
+      money11 = #{money11,jdbcType=FLOAT},
+      times11 = #{times11,jdbcType=INTEGER},
+      amount12 = #{amount12,jdbcType=FLOAT},
+      money12 = #{money12,jdbcType=FLOAT},
+      times12 = #{times12,jdbcType=INTEGER}
     where id = #{id,jdbcType=BIGINT}
   </update>
 
-
-  <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics">
-    select client_id, sum(amount) as amount, sum(money) as money
+  <select id="selectByYear" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
     from st_client_amount_month
-    where `year` = #{year,jdbcType=INTEGER}
-    group by client_id
+    <where>
+      <if test="year != null">
+        and year = #{year,jdbcType=INTEGER}
+      </if>
+    </where>
   </select>
 
+
+  <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics">
+    select client_id as clientId,
+    sum(
+    IFNULL(amount1,0) + IFNULL(amount2,0) + IFNULL(amount3,0) + IFNULL(amount4,0) + IFNULL(amount5,0) + IFNULL(amount6,0) + IFNULL(amount7,0) + IFNULL(amount8,0) + IFNULL(amount9,0) +
+    IFNULL(amount10,0) + IFNULL(amount11,0) + IFNULL(amount12,0)
+    ) as amount,
+    sum(
+    IFNULL(money1,0) + IFNULL(money2,0) + IFNULL(money3,0) + IFNULL(money4,0) + IFNULL(money5,0) + IFNULL(money6,0) + IFNULL(money7,0) + IFNULL(money8,0) + IFNULL(money9,0) +
+    IFNULL(money10,0) + IFNULL(money11,0) + IFNULL(money12,0)
+    ) as money,
+    sum(
+    IFNULL(times1,0) + IFNULL(times2,0) + IFNULL(times3,0) + IFNULL(times4,0) + IFNULL(times5,0) + IFNULL(times6,0) + IFNULL(times7,0) + IFNULL(times8,0) + IFNULL(times9,0) +
+    IFNULL(times10,0) + IFNULL(times11,0) + IFNULL(times12,0)
+    ) as times
+    from st_client_amount_month
+    where year = #{year, jdbcType=INTEGER}
+    group by client_id
+
+  </select>
+
+  <!-- ////////////////////////////////// -->
+  <!-- 涓存椂浠诲姟鐩稿叧                         -->
+  <!-- ////////////////////////////////// -->
+  <delete id="deleteAll">
+    delete from st_client_amount_month
+  </delete>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0