From f1d079f9c0b3d384090477ca54e0548373d62b57 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 16 Jan 2025 11:56:39 +0800
Subject: [PATCH] 配置修改
---
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 194 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 185 insertions(+), 9 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 28f79f1..a78afb5 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
@@ -13,13 +13,39 @@
@Repository
public interface DeviceMapper {
- @Select("SELECT * FROM device WHERE deviceId = #{deviceId}")
+ @Select("SELECT " +
+ "deviceId, " +
+ "coalesce(custom_name, name) as name, " +
+ "password, " +
+ "manufacture, " +
+ "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 (" +
"deviceId, " +
"name, " +
- "manufacturer, " +
+ "manufacture, " +
"model, " +
"firmware, " +
"transport," +
@@ -34,11 +60,17 @@
"updateTime," +
"charset," +
"subscribeCycleForCatalog," +
+ "subscribeCycleForMobilePosition," +
+ "mobilePositionSubmissionInterval," +
+ "subscribeCycleForAlarm," +
+ "ssrcCheck," +
+ "geoCoordSys," +
+ "treeType," +
"online" +
") VALUES (" +
"#{deviceId}," +
"#{name}," +
- "#{manufacturer}," +
+ "#{manufacture}," +
"#{model}," +
"#{firmware}," +
"#{transport}," +
@@ -53,6 +85,12 @@
"#{updateTime}," +
"#{charset}," +
"#{subscribeCycleForCatalog}," +
+ "#{subscribeCycleForMobilePosition}," +
+ "#{mobilePositionSubmissionInterval}," +
+ "#{subscribeCycleForAlarm}," +
+ "#{ssrcCheck}," +
+ "#{geoCoordSys}," +
+ "#{treeType}," +
"#{online}" +
")")
int add(Device device);
@@ -61,11 +99,10 @@
"UPDATE device " +
"SET updateTime='${updateTime}'" +
"<if test=\"name != null\">, name='${name}'</if>" +
- "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
+ "<if test=\"manufacture != null\">, manufacture='${manufacture}'</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>" +
@@ -73,18 +110,157 @@
"<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);
- @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de")
- List<Device> getDevices();
+ @Select(value = {" <script> " +
+ "SELECT " +
+ "de.deviceId, " +
+ "coalesce(custom_name, name) as name, " +
+ "password, " +
+ "manufacture, " +
+ "model, " +
+ "firmware, " +
+ "transport," +
+ "streamMode," +
+ "ip," +
+ "port," +
+ "hostAddress," +
+ "expires," +
+ "registerTime," +
+ "keepaliveTime," +
+ "createTime," +
+ "updateTime," +
+ "charset," +
+ "subscribeCycleForCatalog," +
+ "subscribeCycleForMobilePosition," +
+ "mobilePositionSubmissionInterval," +
+ "subscribeCycleForAlarm," +
+ "ssrcCheck," +
+ "geoCoordSys," +
+ "treeType," +
+ "online," +
+ "dmp.latitude AS latitude," +
+ "dmp.longitude AS longitude, " +
+ "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de" +
+ " LEFT JOIN ( SELECT " +
+ "deviceId,ANY_VALUE(longitude)as longitude,ANY_VALUE(latitude) as latitude,ANY_VALUE(time) as time " +
+ "FROM" +
+ "( SELECT * FROM device_mobile_position ORDER BY time DESC LIMIT 1000 ) t " +
+ "GROUP BY" +
+ " deviceId ) dmp ON de.deviceId = dmp.deviceId" +
+ " WHERE 1=1 " +
+ "<if test='name != null' > AND name like '%${name}%'</if>" +
+ " </script>"})
+ List<Device> getDevices(String name);
@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, " +
+ "password, " +
+ "manufacture, " +
+ "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 " +
+ "deviceId, " +
+ "coalesce(custom_name, name) as name, " +
+ "password, " +
+ "manufacture, " +
+ "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=\"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>" +
+ "<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);
+
+ @Insert("INSERT INTO device (" +
+ "deviceId, " +
+ "custom_name, " +
+ "password, " +
+ "createTime," +
+ "updateTime," +
+ "charset," +
+ "ssrcCheck," +
+ "geoCoordSys," +
+ "treeType," +
+ "online" +
+ ") VALUES (" +
+ "#{deviceId}," +
+ "#{name}," +
+ "#{password}," +
+ "#{createTime}," +
+ "#{updateTime}," +
+ "#{charset}," +
+ "#{ssrcCheck}," +
+ "#{geoCoordSys}," +
+ "#{treeType}," +
+ "#{online}" +
+ ")")
+ void addCustomDevice(Device device);
}
--
Gitblit v1.9.3