Ver código fonte

Merge branch 'wvp-28181-2.0' into wvp-28181-2.0

648540858 3 anos atrás
pai
commit
20cd60c66c

Diferenças do arquivo suprimidas por serem muito extensas
+ 5 - 5
sql/mysql.sql


+ 3 - 1
sql/update.sql

@@ -1,4 +1,4 @@
-alter table wvp.media_server
+alter table media_server
     drop column streamNoneReaderDelayMS;
 
 alter table stream_proxy
@@ -6,3 +6,5 @@ alter table stream_proxy
 
 alter table device
     add mediaServerId varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'auto';
+alter table device
+    add custom_name varchar(255) default null;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

@@ -360,7 +360,7 @@ public class DeviceServiceImpl implements IDeviceService {
         device.setUpdateTime(now);
         device.setCharset(device.getCharset().toUpperCase());
         device.setUpdateTime(DateUtil.getNow());
-        if (deviceMapper.update(device) > 0) {
+        if (deviceMapper.updateCustom(device) > 0) {
             redisCatchStorage.updateDevice(device);
 
         }

+ 126 - 4
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java

@@ -13,7 +13,32 @@ import java.util.List;
 @Repository
 public interface DeviceMapper {
 
-    @Select("SELECT * FROM device WHERE deviceId = #{deviceId}")
+    @Select("SELECT " +
+            "deviceId, " +
+            "coalesce(custom_name, name) as name, " +
+            "manufacturer, " +
+            "model, " +
+            "firmware, " +
+            "transport," +
+            "streamMode," +
+            "ip," +
+            "port," +
+            "hostAddress," +
+            "expires," +
+            "registerTime," +
+            "keepaliveTime," +
+            "createTime," +
+            "updateTime," +
+            "charset," +
+            "subscribeCycleForCatalog," +
+            "subscribeCycleForMobilePosition," +
+            "mobilePositionSubmissionInterval," +
+            "subscribeCycleForAlarm," +
+            "ssrcCheck," +
+            "geoCoordSys," +
+            "treeType," +
+            "online" +
+            " FROM device WHERE deviceId = #{deviceId}")
     Device getDeviceByDeviceId(String deviceId);
 
     @Insert("INSERT INTO device (" +
@@ -98,7 +123,32 @@ public interface DeviceMapper {
             " </script>"})
     int update(Device device);
 
-    @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de")
+    @Select("SELECT " +
+            "deviceId, " +
+            "coalesce(custom_name, name) as name, " +
+            "manufacturer, " +
+            "model, " +
+            "firmware, " +
+            "transport," +
+            "streamMode," +
+            "ip," +
+            "port," +
+            "hostAddress," +
+            "expires," +
+            "registerTime," +
+            "keepaliveTime," +
+            "createTime," +
+            "updateTime," +
+            "charset," +
+            "subscribeCycleForCatalog," +
+            "subscribeCycleForMobilePosition," +
+            "mobilePositionSubmissionInterval," +
+            "subscribeCycleForAlarm," +
+            "ssrcCheck," +
+            "geoCoordSys," +
+            "treeType," +
+            "online," +
+            "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de")
     List<Device> getDevices();
 
     @Delete("DELETE FROM device WHERE deviceId=#{deviceId}")
@@ -107,8 +157,80 @@ public interface DeviceMapper {
     @Update("UPDATE device SET online=0")
     int outlineForAll();
 
-    @Select("SELECT * FROM device WHERE online = 1")
+    @Select("SELECT " +
+            "deviceId, " +
+            "coalesce(custom_name, name) as name, " +
+            "manufacturer, " +
+            "model, " +
+            "firmware, " +
+            "transport," +
+            "streamMode," +
+            "ip," +
+            "port," +
+            "hostAddress," +
+            "expires," +
+            "registerTime," +
+            "keepaliveTime," +
+            "createTime," +
+            "updateTime," +
+            "charset," +
+            "subscribeCycleForCatalog," +
+            "subscribeCycleForMobilePosition," +
+            "mobilePositionSubmissionInterval," +
+            "subscribeCycleForAlarm," +
+            "ssrcCheck," +
+            "geoCoordSys," +
+            "treeType," +
+            "online" +
+            " FROM device WHERE online = 1")
     List<Device> getOnlineDevices();
-    @Select("SELECT * FROM device WHERE ip = #{host} AND port=${port}")
+    @Select("SELECT " +
+            "deviceId, " +
+            "coalesce(custom_name, name) as name, " +
+            "manufacturer, " +
+            "model, " +
+            "firmware, " +
+            "transport," +
+            "streamMode," +
+            "ip," +
+            "port," +
+            "hostAddress," +
+            "expires," +
+            "registerTime," +
+            "keepaliveTime," +
+            "createTime," +
+            "updateTime," +
+            "charset," +
+            "subscribeCycleForCatalog," +
+            "subscribeCycleForMobilePosition," +
+            "mobilePositionSubmissionInterval," +
+            "subscribeCycleForAlarm," +
+            "ssrcCheck," +
+            "geoCoordSys," +
+            "treeType," +
+            "online" +
+            " FROM device WHERE ip = #{host} AND port=${port}")
     Device getDeviceByHostAndPort(String host, int port);
+
+    @Update(value = {" <script>" +
+            "UPDATE device " +
+            "SET updateTime='${updateTime}'" +
+            "<if test=\"name != null\">, custom_name='${name}'</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=\"charset != null\">, charset='${charset}'</if>" +
+            "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +
+            "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" +
+            "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" +
+            "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +
+            "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
+            "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
+            "<if test=\"treeType != null\">, treeType=#{treeType}</if>" +
+            "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
+            "WHERE deviceId='${deviceId}'"+
+            " </script>"})
+    int updateCustom(Device device);
 }

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff