From 56859d09df8d4226882d43934acf32d60a3b51d7 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 30 三月 2021 18:46:34 +0800
Subject: [PATCH] 添加推流列表和拉流代理,下一步与国标关联

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 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 3c10618..f6e328b 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
@@ -43,19 +43,21 @@
             ")")
     int add(Device device);
 
-
-    @Update("UPDATE device " +
-            "SET name=#{name}, " +
-            "manufacturer=#{manufacturer}," +
-            "model=#{model}," +
-            "firmware=#{firmware}, " +
-            "transport=#{transport}," +
-            "streamMode=#{streamMode}, " +
-            "ip=#{ip}, " +
-            "port=#{port}, " +
-            "hostAddress=#{hostAddress}, " +
-            "online=#{online} " +
-            "WHERE deviceId=#{deviceId}")
+    @Update(value = {" <script>" +
+                "UPDATE device " +
+                "SET deviceId='${deviceId}'" +
+                "<if test=\"name != null\">, name='${name}'</if>" +
+                "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
+                "<if test=\"model != null\">, model='${model}'</if>" +
+                "<if test=\"firmware != null\">, firmware='${firmware}'</if>" +
+                "<if test=\"transport != null\">, transport='${transport}'</if>" +
+                "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
+                "<if test=\"ip != null\">, ip='${ip}'</if>" +
+                "<if test=\"port != null\">, port=${port}</if>" +
+                "<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +
+                "<if test=\"online != null\">, online=${online}</if>" +
+                "WHERE deviceId='${deviceId}'"+
+            " </script>"})
     int update(Device device);
 
     @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de")

--
Gitblit v1.8.0