From df11956c3c203434d3ef54955a502c466f1382dd Mon Sep 17 00:00:00 2001 From: 64850858 <648540858@qq.com> Date: 星期一, 07 六月 2021 15:42:01 +0800 Subject: [PATCH] 取出错误配置 --- src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 40 +++++++++++++++++++++++++++------------- 1 files changed, 27 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..d597f35 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 @@ -27,6 +27,9 @@ "ip," + "port," + "hostAddress," + + "expires," + + "registerTime," + + "keepaliveTime," + "online" + ") VALUES (" + "#{deviceId}," + @@ -39,23 +42,31 @@ "#{ip}," + "#{port}," + "#{hostAddress}," + + "#{expires}," + + "#{registerTime}," + + "#{keepaliveTime}," + "#{online}" + ")") 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>" + + "<if test=\"registerTime != null\">, registerTime='${registerTime}'</if>" + + "<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" + + "<if test=\"expires != null\">, expires=${expires}</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") @@ -63,4 +74,7 @@ @Delete("DELETE FROM device WHERE deviceId=#{deviceId}") int del(String deviceId); + + @Update("UPDATE device SET online=0") + int outlineForAll(); } -- Gitblit v1.8.0