From d4c8e72800fcf6fbaa3804d383c7b6a23f826f3e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 20 八月 2025 14:35:00 +0800
Subject: [PATCH] 修改bug

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml |   99 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 76 insertions(+), 23 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml
index 70353ff..f3678df 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml
@@ -134,7 +134,8 @@
         select
         count(*) as count
         from rm_on_hour_report_last tb
-        where tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
+        inner join pr_intake tbIn on tb.intake_id = tbIn.id
+        where tbIn.deleted != 1 and tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
     </select>
 
     <select id="mTotalCountOfNoReport" resultType="java.lang.Integer">
@@ -146,7 +147,7 @@
                 from rm_on_hour_report_last ltb
                 where ltb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
             ) temTb on tb.id = temTb.intake_id
-        where temTb.intake_id is null
+        where tb.deleted != 1 and temTb.intake_id is null
     </select>
 
 
@@ -158,7 +159,7 @@
                 select ltb.intake_id
                 from rm_on_hour_report_last ltb
             ) temTb on tb.id = temTb.intake_id
-        where temTb.intake_id is null
+        where tb.deleted != 1 and temTb.intake_id is null
     </select>
 
 
@@ -168,7 +169,8 @@
         select
         count(*) as count
         from rm_alarm_state_last tb
-        where valve_state = 0
+        inner join pr_intake tbIn on tb.intake_id = tbIn.id
+        where tbIn.deleted != 1 and valve_state = 0
         <if test="fromDt != null ">
             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
         </if>
@@ -178,7 +180,8 @@
         select
         count(*) as count
         from rm_alarm_state_last tb
-        where valve_state = 1
+        inner join pr_intake tbIn on tb.intake_id = tbIn.id
+        where tbIn.deleted != 1 and valve_state = 1
         <if test="fromDt != null ">
             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
         </if>
@@ -193,7 +196,7 @@
                 select ltb.intake_id
                 from rm_alarm_state_last ltb
             ) temTb on tb.id = temTb.intake_id
-        where temTb.intake_id is null
+        where tb.deleted != 1 and temTb.intake_id is null
     </select>
 
 
@@ -201,7 +204,9 @@
         select
         count(*) as count
         from rm_alarm_state_last tb
-        where (alarm_remain_water = 1 or
+        inner join pr_intake tbIn on tb.intake_id = tbIn.id
+        where tbIn.deleted != 1 and
+        (alarm_remain_water = 1 or
         alarm_exceed_year = 1 or
         alarm_water_meter_fault = 1 or
         alarm_loss = 1 or
@@ -212,7 +217,6 @@
         alarm_ele_miss = 1 or
         alarm_ele_exceed = 1 or
         alarm_ele_low_volt = 1 or
-        state_ic_enable = 1 or
         alarm_battery_volt = 1 or
         alarm_valve = 1)
         <if test="fromDt != null ">
@@ -224,20 +228,21 @@
         select
         count(*) as count
         from rm_alarm_state_last tb
-        where ((alarm_remain_water is null or alarm_remain_water = 0) and
-        (alarm_remain_water is null or alarm_exceed_year = 0)  and
-        (alarm_remain_water is null or alarm_water_meter_fault = 0)  and
-        (alarm_remain_water is null or alarm_loss = 0)  and
-        (alarm_remain_water is null or alarm_water_meter_break = 0)  and
-        (alarm_remain_water is null or alarm_ele_meter_fault = 0)  and
-        (alarm_remain_water is null or alarm_inner_door = 0)  and
-        (alarm_remain_water is null or alarm_outer_door = 0)  and
-        (alarm_remain_water is null or alarm_ele_miss = 0)  and
-        (alarm_remain_water is null or alarm_ele_exceed = 0)  and
-        (alarm_remain_water is null or alarm_ele_low_volt = 0)  and
-        (alarm_remain_water is null or state_ic_enable = 0)  and
-        (alarm_remain_water is null or alarm_battery_volt = 0)  and
-        (alarm_remain_water is null or alarm_valve = 0) )
+        inner join pr_intake tbIn on tb.intake_id = tbIn.id
+        where tbIn.deleted != 1 and
+        ((alarm_remain_water is null or alarm_remain_water = 0) and
+        (alarm_exceed_year is null or alarm_exceed_year = 0)  and
+        (alarm_water_meter_fault is null or alarm_water_meter_fault = 0)  and
+        (alarm_loss is null or alarm_loss = 0)  and
+        (alarm_water_meter_break is null or alarm_water_meter_break = 0)  and
+        (alarm_ele_meter_fault is null or alarm_ele_meter_fault = 0)  and
+        (alarm_inner_door is null or alarm_inner_door = 0)  and
+        (alarm_outer_door is null or alarm_outer_door = 0)  and
+        (alarm_ele_miss is null or alarm_ele_miss = 0)  and
+        (alarm_ele_exceed is null or alarm_ele_exceed = 0)  and
+        (alarm_ele_low_volt is null or alarm_ele_low_volt = 0)  and
+        (alarm_battery_volt is null or alarm_battery_volt = 0)  and
+        (alarm_valve is null or alarm_valve = 0) )
         <if test="fromDt != null ">
             AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP}
         </if>
@@ -265,7 +270,55 @@
                    (ltb.alarm_remain_water is null or ltb.alarm_battery_volt = 0)  and
                    (ltb.alarm_remain_water is null or ltb.alarm_valve = 0) )
         ) temTb on tb.id = temTb.intake_id
-        where temTb.intake_id is null
+        where tb.deleted != 1 and temTb.intake_id is null
+    </select>
+
+
+
+
+    <select id="topXClientAtCertainDay" resultType="com.dy.pipIrrGlobal.voSpecial.VoTopXClient">
+        select mTb.id as id, mTb.client_id as clientId,
+        scTb.name as clientName, scTb.clientNum as clientNum, scTb.address as clientAddress,
+        mTb.amount as amount
+        from rm_client_amount_day mTb
+        left join se_client scTb on scTb.id = mTb.client_id
+        <where>
+            <if test = "idStart != null">
+                mTb.id <![CDATA[>=]]> #{idStart, javaType=LONG, jdbcType=BIGINT}
+            </if>
+            <if test = "idEnd != null">
+                and mTb.id <![CDATA[<=]]> #{idEnd, javaType=LONG, jdbcType=BIGINT}
+            </if>
+        </where>
+        order by mTb.amount DESC
+        <trim prefix="limit " >
+            <if test="count != null">
+                0, #{count,javaType=Integer, jdbcType=INTEGER}
+            </if>
+        </trim>
+    </select>
+
+
+    <select id="topXIntakeAtCertainDay" resultType="com.dy.pipIrrGlobal.voSpecial.VoTopXIntake">
+        select mTb.id as id, mTb.intake_id as intakeId,
+        piTb.name as intakeNum, piTb.lng as intakeLng, piTb.lat as intakeLat,
+        mTb.amount as amount
+        from rm_intake_amount_day mTb
+        left join pr_intake piTb on piTb.id = mTb.intake_id
+        <where>
+            <if test = "idStart != null">
+                mTb.id <![CDATA[>=]]> #{idStart, javaType=LONG, jdbcType=BIGINT}
+            </if>
+            <if test = "idEnd != null">
+                and mTb.id <![CDATA[<=]]> #{idEnd, javaType=LONG, jdbcType=BIGINT}
+            </if>
+        </where>
+        order by mTb.amount DESC
+        <trim prefix="limit " >
+            <if test="count != null">
+                0, #{count,javaType=Integer, jdbcType=INTEGER}
+            </if>
+        </trim>
     </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0