From 4f6a87494a6117ba10e4f0769bcd59a5bd30474d Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期四, 01 八月 2024 15:51:40 +0800
Subject: [PATCH] 远程测控八个接口解决bug

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml |   44 ++++++++++++++++++++++++++++++--------------
 1 files changed, 30 insertions(+), 14 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 54809d4..afcd2da 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -379,26 +379,36 @@
       <if test="intakeNum != null and intakeNum != ''">
         AND inta.name = #{intakeNum}
       </if>
+      <if test="isBinded == 0">
+        AND inta.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0)
+      </if>
+      <if test="isBinded == 1">
+        AND inta.id IN(SELECT intakeId FROM pr_controller where deleted = 0)
+      </if>
     </where>
   </select>
 
   <!--鑾峰彇鍙栨按鍙e垪琛紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�-->
   <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
     SELECT
-      con.intakeId,
-      con.rtuAddr,
-      inta.name AS intakeNum,
-      rtus.isOnLine
-    FROM pr_controller con
-        INNER JOIN pr_intake inta ON con.intakeId = inta.id
-        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 con.rtuAddr = rtus.rtuAddr
+    inta.id AS intakeId,
+    con.rtuAddr,
+    inta.name AS intakeNum,
+    (CASE
+    WHEN con.rtuAddr IS  NULL  THEN "false"
+    WHEN con.rtuAddr IS NOT NULL THEN "true"
+    END) AS isBinded,
+    rtus.isOnLine
+    FROM pr_intake inta
+    LEFT JOIN pr_controller con ON con.intakeId = inta.id
+    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 con.rtuAddr = rtus.rtuAddr
     <where>
       <if test="isOnLine != null">
         rtus.isOnLine = #{isOnLine}
@@ -406,6 +416,12 @@
       <if test="intakeNum != null and intakeNum != ''">
         AND inta.name = #{intakeNum}
       </if>
+      <if test="isBinded == false ">
+        AND con.rtuAddr IS  NULL
+      </if>
+      <if test="isBinded == true ">
+        AND con.rtuAddr IS NOT NULL
+      </if>
     </where>
     order by con.id ASC
     <if test="pageCurr != null and pageSize != null">

--
Gitblit v1.8.0