From 277ec59299c5909dafecbe6e5afa85dd3278ade7 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 16 十月 2024 09:13:23 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml |   78 +++++++++++++++++++++++++++++++--------
 1 files changed, 62 insertions(+), 16 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 60412c5..61ec6b3 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -225,16 +225,25 @@
     <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
         SELECT COUNT(*) AS recordCount
         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
-                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
+        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
+        LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
+        left JOIN JSON_TABLE(
+        <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
+        #{onLineMap},
+        '$[*]' COLUMNS(
+        rtuAddr VARCHAR(20) PATH '$.rtuAddr',
+        isOnLine BOOLEAN PATH '$.isOnLine'
+        )
+        ) rtus ON cont.rtuAddr = rtus.rtuAddr
         <where>
             ge.deleted = 0
-              AND divi.deleted = 0
-              and blo.deleted = 0
+            AND divi.deleted = 0
+            AND blo.deleted = 0
+            AND cont.deleted = 0
             <if test="intakeName != null and intakeName != ''">
                 AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
             </if>
@@ -257,6 +266,18 @@
             </if>
             <if test="address != null and address != ''">
                 AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
+            </if>
+            <if test = "rtuAddr != null and rtuAddr !=''">
+                AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%')
+            </if>
+            <if test="isOnLine != null and isOnLine !='' ">
+                AND rtus.isOnLine = #{isOnLine}
+            </if>
+            <if test="protocol != null and protocol !='' ">
+                AND cont.protocol = #{protocol}
+            </if>
+            <if test = "bindNumber != null and bindNumber > 0">
+                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber}
             </if>
         </where>
     </select>
@@ -271,6 +292,10 @@
                blo.`name`                                          AS blockName,
                CAST(cont.id AS char)                               AS controllerId,
                cont.rtuAddr                                        AS rtuAddr,
+                cont.protocol                                       AS protocol,
+                cont.findDt                                         AS findDt,
+                rtus.isOnLine                                       AS isOnLine,
+                (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) AS bindNumber,
                ge.lng,
                ge.lat,
                ge.remarks,
@@ -282,16 +307,25 @@
                    END)                                            AS isBind,
                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
-                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
+                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
+                LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
+                left JOIN JSON_TABLE(
+                <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
+                #{onLineMap},
+                '$[*]' COLUMNS(
+                rtuAddr VARCHAR(20) PATH '$.rtuAddr',
+                isOnLine BOOLEAN PATH '$.isOnLine'
+                )
+                ) rtus ON cont.rtuAddr = rtus.rtuAddr
         <where>
             ge.deleted = 0
-              AND divi.deleted = 0
-              and blo.deleted = 0
+            AND divi.deleted = 0
+            AND blo.deleted = 0
+            AND cont.deleted = 0
             <if test="intakeName != null and intakeName != ''">
                 AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
             </if>
@@ -315,6 +349,18 @@
             <if test="address != null and address != ''">
                 AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
             </if>
+            <if test = "rtuAddr != null and rtuAddr !=''">
+                AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%')
+            </if>
+            <if test="isOnLine != null and isOnLine !='' ">
+                AND rtus.isOnLine = #{isOnLine}
+            </if>
+            <if test="protocol != null and protocol !='' ">
+                AND cont.protocol = #{protocol}
+            </if>
+            <if test = "bindNumber != null and bindNumber > 0">
+                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber}
+            </if>
         </where>
         ORDER BY ge.operateDt DESC
         <trim prefix="limit ">

--
Gitblit v1.8.0