From 7e48d847402d2ea4da85af582529de676f30dc38 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 08 五月 2023 17:56:56 +0800
Subject: [PATCH] Merge pull request #844 from xiaoQQya/wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 116 +++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 78 insertions(+), 38 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 b1210c6..fe739ea 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
@@ -24,6 +24,8 @@
"transport," +
"streamMode," +
"ip," +
+ "sdpIp," +
+ "localIp," +
"port," +
"hostAddress," +
"expires," +
@@ -37,9 +39,12 @@
"mobilePositionSubmissionInterval," +
"subscribeCycleForAlarm," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
- "online" +
+ "online," +
+ "mediaServerId," +
+ "(SELECT count(0) FROM device_channel WHERE deviceId=device.deviceId) as channelCount "+
" FROM device WHERE deviceId = #{deviceId}")
Device getDeviceByDeviceId(String deviceId);
@@ -52,11 +57,14 @@
"transport," +
"streamMode," +
"ip," +
+ "sdpIp," +
+ "localIp," +
"port," +
"hostAddress," +
"expires," +
"registerTime," +
"keepaliveTime," +
+ "keepaliveIntervalTime," +
"createTime," +
"updateTime," +
"charset," +
@@ -65,6 +73,7 @@
"mobilePositionSubmissionInterval," +
"subscribeCycleForAlarm," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
"online" +
@@ -77,11 +86,14 @@
"#{transport}," +
"#{streamMode}," +
"#{ip}," +
+ "#{sdpIp}," +
+ "#{localIp}," +
"#{port}," +
"#{hostAddress}," +
"#{expires}," +
"#{registerTime}," +
"#{keepaliveTime}," +
+ "#{keepaliveIntervalTime}," +
"#{createTime}," +
"#{updateTime}," +
"#{charset}," +
@@ -90,6 +102,7 @@
"#{mobilePositionSubmissionInterval}," +
"#{subscribeCycleForAlarm}," +
"#{ssrcCheck}," +
+ "#{asMessageChannel}," +
"#{geoCoordSys}," +
"#{treeType}," +
"#{online}" +
@@ -98,24 +111,28 @@
@Update(value = {" <script>" +
"UPDATE device " +
- "SET updateTime='${updateTime}'" +
- "<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=\"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}'"+
+ "SET updateTime=#{updateTime}" +
+ "<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=\"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>" +
+ "<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" +
+ "<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" +
+ "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" +
+ "<if test=\"expires != null\">, expires=#{expires}</if>" +
+ "WHERE deviceId=#{deviceId}"+
" </script>"})
int update(Device device);
- @Select("SELECT " +
+ @Select(
+ " <script>" +
+ "SELECT " +
"deviceId, " +
"coalesce(custom_name, name) as name, " +
"password, " +
@@ -125,6 +142,8 @@
"transport," +
"streamMode," +
"ip," +
+ "sdpIp," +
+ "localIp," +
"port," +
"hostAddress," +
"expires," +
@@ -138,18 +157,20 @@
"mobilePositionSubmissionInterval," +
"subscribeCycleForAlarm," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
"online," +
- "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de")
- List<Device> getDevices();
+ "mediaServerId," +
+ "(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);
- @Update("UPDATE device SET online=0")
- int outlineForAll();
-
@Select("SELECT " +
"deviceId, " +
"coalesce(custom_name, name) as name, " +
@@ -160,6 +181,8 @@
"transport," +
"streamMode," +
"ip," +
+ "sdpIp," +
+ "localIp," +
"port," +
"hostAddress," +
"expires," +
@@ -173,6 +196,7 @@
"mobilePositionSubmissionInterval," +
"subscribeCycleForAlarm," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
"online " +
@@ -188,6 +212,8 @@
"transport," +
"streamMode," +
"ip," +
+ "sdpIp," +
+ "localIp," +
"port," +
"hostAddress," +
"expires," +
@@ -201,59 +227,73 @@
"mobilePositionSubmissionInterval," +
"subscribeCycleForAlarm," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
"online" +
- " FROM device WHERE ip = #{host} AND port=${port}")
+ " 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=\"password != null\">, password='${password}'</if>" +
- "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
- "<if test=\"ip != null\">, ip='${ip}'</if>" +
- "<if test=\"port != null\">, port=${port}</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>" +
+ "SET updateTime=#{updateTime}" +
+ "<if test=\"name != null\">, custom_name=#{name}</if>" +
+ "<if test=\"password != null\">, password=#{password}</if>" +
+ "<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" +
+ "<if test=\"ip != null\">, ip=#{ip}</if>" +
+ "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
+ "<if test=\"port != null\">, port=#{port}</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=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</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}'"+
+ "WHERE deviceId=#{deviceId}"+
" </script>"})
- int updateCustom(Device device);
+ void updateCustom(Device device);
@Insert("INSERT INTO device (" +
"deviceId, " +
"custom_name, " +
"password, " +
+ "sdpIp, " +
"createTime," +
"updateTime," +
"charset," +
"ssrcCheck," +
+ "asMessageChannel," +
"geoCoordSys," +
"treeType," +
- "online" +
+ "online," +
+ "mediaServerId" +
") VALUES (" +
"#{deviceId}," +
"#{name}," +
"#{password}," +
+ "#{sdpIp}," +
"#{createTime}," +
"#{updateTime}," +
"#{charset}," +
"#{ssrcCheck}," +
+ "#{asMessageChannel}," +
"#{geoCoordSys}," +
"#{treeType}," +
- "#{online}" +
+ "#{online}," +
+ "#{mediaServerId}" +
")")
void addCustomDevice(Device device);
@Select("select count(1) as total, sum(online) as online from device")
ResourceBaceInfo getOverview();
+ @Select("select * from device")
+ List<Device> getAll();
+
+ @Select("select * from device where asMessageChannel = 1")
+ List<Device> queryDeviceWithAsMessageChannel();
}
--
Gitblit v1.8.0