From a42dda2bd3cc1cf8c20cc61e7ad9211eadecbaf3 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 24 二月 2022 16:55:06 +0800 Subject: [PATCH] 规范数据库,添加必要约束,优化通道批量导入功能 --- src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 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 bcc33de..ed2d8c8 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,13 @@ "ip," + "port," + "hostAddress," + + "expires," + + "registerTime," + + "keepaliveTime," + + "createTime," + + "updateTime," + + "charset," + + "subscribeCycleForCatalog," + "online" + ") VALUES (" + "#{deviceId}," + @@ -39,13 +46,20 @@ "#{ip}," + "#{port}," + "#{hostAddress}," + + "#{expires}," + + "#{registerTime}," + + "#{keepaliveTime}," + + "#{createTime}," + + "#{updateTime}," + + "#{charset}," + + "#{subscribeCycleForCatalog}," + "#{online}" + ")") int add(Device device); @Update(value = {" <script>" + "UPDATE device " + - "SET deviceId='${deviceId}'" + + "SET updateTime='${updateTime}'" + "<if test=\"name != null\">, name='${name}'</if>" + "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" + "<if test=\"model != null\">, model='${model}'</if>" + @@ -56,6 +70,11 @@ "<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>" + + "<if test=\"charset != null\">, charset='${charset}'</if>" + + "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" + "WHERE deviceId='${deviceId}'"+ " </script>"}) int update(Device device); -- Gitblit v1.8.0