From a15a8cfd7b01ce4bba6fe9fd876f6704ca23a12d Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 07 一月 2025 16:40:32 +0800
Subject: [PATCH] 1、取水口用水日统计表中增加金额、次数字段; 2、优化或重写“累计流量超过指定值的取水口”、“累计流量低于指定值的取水口”、“指定时间段内用水量超过指定值的取水口”、“指定时间段内消费金额超过指定值的取水口”几个统计查询; 3、改“指定时间段内用水时长超过指定值的取水口”为“指定时间段内用水次数超过指定值的取水口”

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml |  112 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 79 insertions(+), 33 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
index 5c02036..eb8e6de 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -34,13 +34,33 @@
         operateDt,
         deleted
     </sql>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoAllIntake">
         <!--@mbg.generated-->
         select
-        <include refid="Base_Column_List"/>
-        from pr_intake
-        where id = #{id,jdbcType=BIGINT}
-        and deleted = 0
+        ge.id,
+        ge.countyId,
+        ge.townId,
+        ge.villageId,
+        ge.divideId,
+        ge.blockId,
+        ge.`name`,
+        ge.lng,
+        ge.lat,
+        ge.remarks,
+        ge.`operator`,
+        ge.operateDt,
+        blo.`name`                                          AS blockName,
+        CONCAT(country.`name`, town.`name`, village.`name`)              AS address
+        FROM pr_intake ge
+        INNER JOIN pr_divide divi ON ge.divideId = divi.id
+        INNER JOIN ba_block blo ON divi.blockId = blo.id
+        LEFT JOIN ba_district country ON ge.countyId = country.id
+        LEFT JOIN ba_district town ON ge.townId = town.id
+        LEFT JOIN ba_district village ON ge.villageId = village.id
+        where ge.id = #{id,jdbcType=BIGINT}
+        AND ge.deleted = 0
+        AND divi.deleted = 0
+        AND blo.deleted = 0
     </select>
 
     <delete id="deleteLogicById" parameterType="java.lang.Long">
@@ -50,12 +70,33 @@
         where id = #{id,jdbcType=BIGINT}
     </delete>
 
-    <select id="selectAll" resultMap="BaseResultMap">
+    <select id="selectAll"  resultType="com.dy.pipIrrGlobal.voPr.VoAllIntake">
         <!--@mbg.generated-->
         select
-        <include refid="Base_Column_List"/>
-        from pr_intake
-        where deleted != 1
+        ge.id,
+        ge.countyId,
+        ge.townId,
+        ge.villageId,
+        ge.divideId,
+        ge.blockId,
+        ge.`name`,
+        ge.lng,
+        ge.lat,
+        ge.remarks,
+        ge.`operator`,
+        ge.operateDt,
+        blo.`name`                                          AS blockName,
+        CONCAT(country.`name`, town.`name`, village.`name`)              AS address
+        FROM pr_intake ge
+        INNER JOIN pr_divide divi ON ge.divideId = divi.id
+        INNER JOIN ba_block blo ON divi.blockId = blo.id
+        LEFT JOIN ba_district country ON ge.countyId = country.id
+        LEFT JOIN ba_district town ON ge.townId = town.id
+        LEFT JOIN ba_district village ON ge.villageId = village.id
+        where
+        ge.deleted = 0
+        AND divi.deleted = 0
+        AND blo.deleted = 0
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         <!--@mbg.generated-->
@@ -552,7 +593,8 @@
         <if test="onLineMap != null and onLineMap !='' and isOnLine != null">
             rtus.isOnLine,
         </if>
-        alarm.alarm
+        alarm.alarm,
+        alarm.alarmDt
         FROM pr_intake inta
         INNER JOIN pr_controller con ON con.intakeId = inta.id
         LEFT JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
@@ -563,7 +605,8 @@
                 IF(alarm_battery_volt = 1, '鐢垫睜鐢靛帇鎶ヨ锛�', ''),
                 IF(alarm_valve = 1, '闃�闂ㄦ姤璀︼紝', ''),
                 IF(alarm_water_meter_fault = 1, '娴侀噺璁℃晠闅滄姤璀︼紝', '')
-            ) AS alarm
+            ) AS alarm,
+            dt AS alarmDt
             FROM rm_alarm_state_last
             WHERE (alarm_loss = 1 OR alarm_battery_volt = 1 OR alarm_valve = 1 OR alarm_water_meter_fault = 1)
             AND dt >= DATE_SUB(NOW(), INTERVAL 12 HOUR)
@@ -603,31 +646,14 @@
         </trim>
     </select>
 
-
-
-
-
-
-
-
-
-
-
     <!--鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栧彇姘村彛瀵硅薄-->
     <select id="getIntakeByName" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
-        SELECT con.intakeId,
-        con.rtuAddr,
-        inta.name AS intakeNum,
-        rtus.isOnLine
+        SELECT
+            con.intakeId,
+            con.rtuAddr,
+            inta.name AS intakeNum
         FROM pr_controller con
-        INNER JOIN pr_intake inta ON con.intakeId = inta.id
-        left JOIN JSON_TABLE(
-        #{onLineMap},
-        '$[*]' COLUMNS (
-        rtuAddr VARCHAR(20) PATH '$.rtuAddr',
-        isOnLine BOOLEAN PATH '$.isOnLine'
-        )
-        ) rtus ON con.rtuAddr = rtus.rtuAddr
+            INNER JOIN pr_intake inta ON con.intakeId = inta.id
         <where>
             <if test="intakeNum != null and intakeNum != ''">
                 AND LOWER(inta.name) = #{intakeNum}
@@ -683,4 +709,24 @@
         WHERE id != #{id}
         and `name` = #{intakeName}
     </select>
+    <!--app淇敼鍙栨按鍙g粡绾害-->
+    <update id="updateByPrimaryKeySelective1" parameterType="com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat">
+        <!--@mbg.generated-->
+        update pr_intake
+        <set>
+            <if test="lng != null">
+                lng = #{lng,jdbcType=DOUBLE},
+            </if>
+            <if test="lat != null">
+                lat = #{lat,jdbcType=DOUBLE},
+            </if>
+            <if test="operator != null">
+                `operator` = #{operator,jdbcType=BIGINT},
+            </if>
+            <if test="operateDt != null">
+                operateDt = #{operateDt,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0