From 37e973949fa14d01d9ad030973a4974e2f4fef2d Mon Sep 17 00:00:00 2001
From: jiang <893224616@qq.com>
Date: 星期三, 28 十二月 2022 10:58:48 +0800
Subject: [PATCH] 优化兼容接口

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
index 9f1214d..b9a5817 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -111,6 +111,7 @@
                 "<if test=\"firmware != null\">, firmware='${firmware}'</if>" +
                 "<if test=\"transport != null\">, transport='${transport}'</if>" +
                 "<if test=\"ip != null\">, ip='${ip}'</if>" +
+                "<if test=\"localIp != null\">, localIp='${localIp}'</if>" +
                 "<if test=\"port != null\">, port=${port}</if>" +
                 "<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +
                 "<if test=\"online != null\">, online=${online}</if>" +
@@ -121,7 +122,9 @@
             " </script>"})
     int update(Device device);
 
-    @Select("SELECT " +
+    @Select(
+            " <script>" +
+            "SELECT " +
             "deviceId, " +
             "coalesce(custom_name, name) as name, " +
             "password, " +
@@ -149,8 +152,11 @@
             "geoCoordSys," +
             "treeType," +
             "online," +
-            "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de")
-    List<Device> getDevices();
+            "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de" +
+            "<if test=\"online != null\"> where online=${online}</if>"+
+            " </script>"
+    )
+    List<Device> getDevices(Boolean online);
 
     @Delete("DELETE FROM device WHERE deviceId=#{deviceId}")
     int del(String deviceId);

--
Gitblit v1.8.0