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/DeviceChannelMapper.java | 530 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 480 insertions(+), 50 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index a08f6b6..e7186fc 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -1,12 +1,16 @@
package com.genersoft.iot.vmp.storager.dao;
+import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
-import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree;
+import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
+import com.genersoft.iot.vmp.gb28181.vo.DeviceChannelVO;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
+import com.genersoft.iot.vmp.vmanager.gb28181.vo.PageVO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
+import java.util.Map;
/**
* 用于存储设备通道信息
@@ -15,17 +19,20 @@
@Repository
public interface DeviceChannelMapper {
- @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
+ @Insert("INSERT INTO device_channel (coordinate,channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
- "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
- "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
+ "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
+ "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
+ "VALUES (ST_GeomFromText(${coordinate}),'${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
- "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')")
+ "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +
+ "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, ${hasAudio}, '${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')")
int add(DeviceChannel channel);
@Update(value = {" <script>" +
"UPDATE device_channel " +
"SET updateTime='${updateTime}'" +
+ "<if test='coordinate != null'>, coordinate=ST_GeomFromText(${coordinate})</if>" +
"<if test='name != null'>, name='${name}'</if>" +
"<if test='manufacture != null'>, manufacture='${manufacture}'</if>" +
"<if test='model != null'>, model='${model}'</if>" +
@@ -50,9 +57,78 @@
"<if test='hasAudio != null'>, hasAudio=${hasAudio}</if>" +
"<if test='longitude != null'>, longitude=${longitude}</if>" +
"<if test='latitude != null'>, latitude=${latitude}</if>" +
+ "<if test='longitudeGcj02 != null'>, longitudeGcj02=${longitudeGcj02}</if>" +
+ "<if test='latitudeGcj02 != null'>, latitudeGcj02=${latitudeGcj02}</if>" +
+ "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
+ "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
+ "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
+ "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
"WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
" </script>"})
int update(DeviceChannel channel);
+
+ /**
+ * 查询设备列表信息
+ * @param deviceId
+ * @param parentChannelId
+ * @param query
+ * @param type
+ * @param hasSubChannel
+ * @param dwbh
+ * @param online
+ * @return
+ */
+ @Select(value = {" <script>" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.channelId,\n" +
+ "dc.`name`,\n" +
+ "dc.manufacture,\n" +
+ "dc.model,\n" +
+ "dc.`owner`,\n" +
+ "dc.civilCode,\n" +
+ "dc.block,\n" +
+ "dc.address,\n" +
+ "dc.parentId,\n" +
+ "dc.safetyWay,\n" +
+ "dc.registerWay,\n" +
+ "dc.certNum,\n" +
+ "dc.certifiable,\n" +
+ "dc.errCode,\n" +
+ "dc.endTime,\n" +
+ "dc.secrecy,\n" +
+ "ST_ASTEXT (coordinate) as coordinate," +
+ "dc.ipAddress,dc.`port`,dc.`password`,dc.PTZType,dc.`status`,dc.streamId,dc.deviceId,\n" +
+ "dc.parental,dc.hasAudio,dc.createTime,dc.updateTime,dc.subCount," +
+ "dc.latitude," +
+ "dc.longitude " +
+ "from " +
+ "device_channel dc " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " inner join device_channel_dept dcd on dc.id = dcd.device_channel_id \n " +
+ " </if> " +
+ "WHERE " +
+ "dc.deviceId = #{deviceId}" +
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n " +
+ " </if> " +
+ " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
+ " <if test='type == 0' > AND dc.name like '%信州%' AND dc.name like '%赣E%'</if>" +
+ " <if test='type == 1' > AND dc.name LIKE '02%' AND dc.name not like '%赣E%' and dc.ipAddress is not null and dc.ipAddress != '' </if>" +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
+ " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
+ " order by dc.`status` desc,dc.channelId desc" +
+ " </script>"})
+ List<DeviceChannelVO> queryChannelsCar(String deviceId,
+ String parentChannelId,
+ String query,
+ String type,
+ Boolean hasSubChannel,
+ String dwbh,
+ Boolean online);
@Select(value = {" <script>" +
"SELECT " +
@@ -76,23 +152,22 @@
"dc.ipAddress,dc.`port`,dc.`password`,dc.PTZType,dc.`status`,dc.streamId,dc.deviceId,\n" +
"dc.parental,dc.hasAudio,dc.createTime,dc.updateTime,dc.subCount," +
"any_value ( CASE WHEN dc.latitude = 0 THEN dmp.latitude ELSE dc.latitude END ) AS latitude," +
- "any_value ( CASE WHEN dc.longitude = 0 THEN dmp.longitude ELSE dc.longitude END ) AS longitude " +
+ "any_value ( CASE WHEN dc.longitude = 0 THEN dmp.longitude ELSE dc.longitude END ) AS longitude, " +
+ "ST_AsGeoJSON ( dc.coordinate ) AS coordinates " +
"from " +
"device_channel dc " +
- "LEFT JOIN device_mobile_position dmp ON dc.channelId = dmp.deviceId " +
- "WHERE " +
- "dc.deviceId = #{deviceId} " +
- " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
- " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
- " <if test='online == true' > AND dc.status=1</if>" +
- " <if test='online == false' > AND dc.status=0</if>" +
- " <if test='type == 0' > AND dc.name like '%赣E%'</if>" +
- " <if test='type == 1' > AND dc.name not like '%赣E%' and dc.ipAddress is not null and dc.ipAddress != '' </if>" +
- " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
- " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
- "GROUP BY dc.channelId " +
+ "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 dc.deviceId = dmp.deviceId " +
+ "WHERE 1=1 " +
+ "and ST_CONTAINS ( ST_POLYGONFROMTEXT ( 'POLYGON((${range}))' ), dc.coordinate )" +
+ " <if test='query!=null ' > AND dc.name LIKE '%${query}%'</if>" +
" </script>"})
- List<DeviceChannel> queryChannelsCar(String deviceId, String parentChannelId, String query,String type, Boolean hasSubChannel, Boolean online);
+ List<DeviceChannel> SpatialQueryList(String range, String query);
+
@Select(value = {" <script>" +
"SELECT " +
"dc.id,\n" +
@@ -112,24 +187,30 @@
"dc.errCode,\n" +
"dc.endTime,\n" +
"dc.secrecy,\n" +
+ "ST_ASTEXT (coordinate) as coordinate," +
"dc.ipAddress,dc.`port`,dc.`password`,dc.PTZType,dc.`status`,dc.streamId,dc.deviceId,\n" +
"dc.parental,dc.hasAudio,dc.createTime,dc.updateTime,dc.subCount," +
"any_value ( CASE WHEN dc.latitude = 0 THEN dmp.latitude ELSE dc.latitude END ) AS latitude," +
"any_value ( CASE WHEN dc.longitude = 0 THEN dmp.longitude ELSE dc.longitude END ) AS longitude " +
"from " +
"device_channel dc " +
- "LEFT JOIN device_mobile_position dmp ON dc.channelId = dmp.deviceId " +
+ "LEFT JOIN (SELECT * FROM device_mobile_position WHERE deviceId = #{deviceId} ORDER BY time desc limit 1) dmp ON dc.channelId = dmp.deviceId " +
"WHERE " +
"dc.deviceId = #{deviceId} " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
- " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
+ " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status=1</if>" +
" <if test='online == false' > AND dc.status=0</if>" +
" <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
- "GROUP BY dc.channelId " +
+ "order by dc.status desc " +
" </script>"})
- List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online);
+ List<DeviceChannel> queryChannels(String deviceId,
+ String parentChannelId,
+ String query,
+ Boolean hasSubChannel,
+ Boolean online,
+ String deptId);
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
DeviceChannel queryChannel(String deviceId, String channelId);
@@ -152,25 +233,38 @@
" dc.channelId,\n" +
" dc.deviceId,\n" +
" dc.name,\n" +
- " de.manufacturer,\n" +
+ " de.manufacture,\n" +
" de.hostAddress,\n" +
" dc.subCount,\n" +
" pgc.platformId as platformId,\n" +
" pgc.catalogId as catalogId " +
" FROM device_channel dc " +
- " LEFT JOIN device de ON dc.deviceId = de.deviceId " +
- " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
+ "LEFT JOIN device de ON dc.deviceId = de.deviceId " +
+ "LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
" WHERE 1=1 " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='online == true' > AND dc.status=1</if> " +
" <if test='online == false' > AND dc.status=0</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " +
- " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount == 0</if> " +
+ " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " +
" <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " +
" <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " +
" ORDER BY dc.deviceId, dc.channelId ASC" +
" </script>"})
List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
+
+ @Select(value = {" <script>" +
+ "SELECT " +
+ " dc.*,\n" +
+ " pgc.platformId as platformId,\n" +
+ " pgc.catalogId as catalogId " +
+ " FROM device_channel dc " +
+ " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
+ " WHERE pgc.platformId = #{platformId} " +
+ " ORDER BY dc.deviceId, dc.channelId ASC" +
+ " </script>"})
+ List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
+
@Select("SELECT * FROM device_channel WHERE channelId=#{channelId}")
List<DeviceChannel> queryChannelByChannelId( String channelId);
@@ -178,22 +272,25 @@
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void offline(String deviceId, String channelId);
- @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
- void online(String deviceId, String channelId);
+ @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"})
+ void offlineByDeviceId(String deviceId);
@Insert("<script> " +
"insert into device_channel " +
- "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
+ "(coordinate,channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
- " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
+ " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
+ " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
- "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
+ "(ST_GeomFromText(${item.coordinate}),'${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
"'${item.owner}', '${item.civilCode}', '${item.block}',${item.subCount}," +
"'${item.address}', ${item.parental}, '${item.parentId}', ${item.safetyWay}, ${item.registerWay}, " +
"'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
- "'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" +
+ "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
+ "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84}, ${item.hasAudio},'${item.createTime}', '${item.updateTime}', " +
+ "'${item.businessGroupId}', '${item.gpsTime}') " +
"</foreach> " +
"ON DUPLICATE KEY UPDATE " +
"updateTime=VALUES(updateTime), " +
@@ -220,15 +317,26 @@
"status=VALUES(status), " +
"streamId=VALUES(streamId), " +
"longitude=VALUES(longitude), " +
- "latitude=VALUES(latitude)" +
+ "latitude=VALUES(latitude), " +
+ "longitudeGcj02=VALUES(longitudeGcj02), " +
+ "latitudeGcj02=VALUES(latitudeGcj02), " +
+ "longitudeWgs84=VALUES(longitudeWgs84), " +
+ "latitudeWgs84=VALUES(latitudeWgs84), " +
+ "hasAudio=VALUES(hasAudio), " +
+ "businessGroupId=VALUES(businessGroupId), " +
+ "gpsTime=VALUES(gpsTime)" +
"</script>")
int batchAdd(List<DeviceChannel> addChannels);
+
+ @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
+ void online(String deviceId, String channelId);
@Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" +
" UPDATE" +
" device_channel" +
" SET updateTime='${item.updateTime}'" +
+ "<if test='item.coordinate != null'>, coordinate=ST_GeomFromText(${item.coordinate})</if>" +
"<if test='item.name != null'>, name='${item.name}'</if>" +
"<if test='item.manufacture != null'>, manufacture='${item.manufacture}'</if>" +
"<if test='item.model != null'>, model='${item.model}'</if>" +
@@ -254,7 +362,13 @@
"<if test='item.hasAudio != null'>, hasAudio=${item.hasAudio}</if>" +
"<if test='item.longitude != null'>, longitude=${item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=${item.latitude}</if>" +
- "WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+
+ "<if test='item.longitudeGcj02 != null'>, longitudeGcj02=${item.longitudeGcj02}</if>" +
+ "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +
+ "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
+ "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
+ "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
+ "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
+ "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
"</foreach>" +
"</script>"})
int batchUpdate(List<DeviceChannel> updateChannels);
@@ -282,21 +396,6 @@
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1")
List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);
- @Select(" SELECT\n" +
- " id,\n" +
- " channelId,\n" +
- " deviceId,\n" +
- " parentId,\n" +
- " status,\n" +
- " name as title,\n" +
- " channelId as \"value\",\n" +
- " channelId as \"key\",\n" +
- " longitude,\n" +
- " latitude\n" +
- " from device_channel\n" +
- " where deviceId = #{deviceId}")
- List<DeviceChannelTree> tree(String deviceId);
-
@Delete(value = {" <script>" +
"DELETE " +
"from " +
@@ -316,4 +415,335 @@
" where deviceId = #{deviceId} " +
" and channelId = #{channelId}")
int updateChannelSubCount(String deviceId, String channelId);
+
+ @Update(value = {" <script>" +
+ "UPDATE device_channel " +
+ "SET " +
+ "latitude=${latitude}, " +
+ "longitude=${longitude}, " +
+ "longitudeGcj02=${longitudeGcj02}, " +
+ "latitudeGcj02=${latitudeGcj02}, " +
+ "longitudeWgs84=${longitudeWgs84}, " +
+ "latitudeWgs84=${latitudeWgs84}, " +
+ "coordinate=ST_GeomFromText(${coordinate}), " +
+ "gpsTime='${gpsTime}' " +
+ "WHERE deviceId=#{deviceId} " +
+ " <if test='channelId != null' > AND channelId=#{channelId}</if>" +
+ " </script>"})
+ void updatePosition(DeviceChannel deviceChannel);
+
+ @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
+ List<DeviceChannel> getAllChannelInPlay();
+
+ @Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}")
+ List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
+
+
+ @Select(value = {" <script>" +
+ "select * " +
+ "from device_channel " +
+ "where deviceId=#{deviceId}" +
+ " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" +
+ " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" +
+ " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +
+ " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" +
+ " </script>"})
+ List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
+
+ @Select(value = {" <script>" +
+ "select * " +
+ "from device_channel " +
+ "where deviceId=#{deviceId} and length(channelId)>14 and civilCode=#{parentId}" +
+ " </script>"})
+ List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId);
+
+ @Select("select min(length(channelId)) as minLength " +
+ "from device_channel " +
+ "where deviceId=#{deviceId}")
+ Integer getChannelMinLength(String deviceId);
+
+ @Select("select * from device_channel where deviceId=#{deviceId} and civilCode not in " +
+ "(select civilCode from device_channel where deviceId=#{deviceId} group by civilCode)")
+ List<DeviceChannel> getChannelWithoutCiviCode(String deviceId);
+
+ @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
+ List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
+
+ @Select("select dc.id, dc.channelId, dc.deviceId, dc.name, dc.manufacture,dc.model,dc.owner, pc.civilCode,dc.block, " +
+ " dc.address, '0' as parental,'0' as channelType, pc.id as parentId, dc.safetyWay, dc.registerWay,dc.certNum, dc.certifiable, " +
+ " dc.errCode,dc.endTime, dc.secrecy, dc.ipAddress, dc.port, dc.PTZType, dc.password, dc.status, " +
+ " dc.longitudeWgs84 as longitude, dc.latitudeWgs84 as latitude, pc.businessGroupId " +
+ " from device_channel dc" +
+ " left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" +
+ " left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" +
+ " where pgc.platformId=#{serverGBId}")
+ List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
+
+ @Select("select * from device_channel where deviceId = #{deviceId}")
+ List<DeviceChannel> queryAllChannels(String deviceId);
+
+ /**
+ * 获取辖区名称
+ * @param dwbh
+ * @return
+ */
+ @Select("select dept_name from srjw.blade_dept where id = #{dwbh}")
+ String getDeptNameByDwbh(@Param("dwbh") String dwbh);
+
+ /**
+ * 查询当前辖区对应的设备通道ids
+ * @param deptName 辖区名称
+ * @return
+ */
+ @Select("select channelId from wvp.device_channel where name like concat(concat('%',#{deptName}),'%')")
+ List<String> getIdsListByDeptName(@Param("deptName") String deptName);
+
+
+ /**
+ * 查询所有
+ * @param deviceId
+ * @param parentChannelId
+ * @param query
+ * @param hasSubChannel
+ * @param dwbh
+ * @param online
+ * @return
+ */
+ @Select(value = {" <script>" +
+ "(SELECT " +
+ "dc.id,\n" +
+ "dc.channelId,\n" +
+ "dc.`name`,\n" +
+ "0 as type," +
+ "dc.status," +
+ "dc.latitude," +
+ "dc.longitude " +
+ "from " +
+ "device_channel dc " +
+ "JOIN device_channel_dept dcd ON dc.id = dcd.device_channel_id " +
+ "WHERE " +
+ "dc.deviceId = #{deviceId} AND dc.name like '%信州%' AND dc.name like '%赣E%' "+
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
+ " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
+ " order by dc.channelId desc " +
+ ") union all (" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.channelId,\n" +
+ "dc.`name`,\n" +
+ "1 as type," +
+ "dc.status," +
+ "dc.latitude," +
+ "dc.longitude " +
+ "from " +
+ "device_channel dc " +
+ "JOIN device_channel_dept dcd ON dc.id = dcd.device_channel_id " +
+ "WHERE " +
+ "dc.deviceId = #{deviceId} AND dc.name LIKE '02%' AND dc.name not like '%赣E%' and dc.ipAddress is not null and dc.ipAddress != '' " +
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
+ " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
+ " order by dc.channelId desc " +
+ ") union all (" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.terminal_number as channelId,\n" +
+ "dcd.`name`,\n" +
+ "2 as type," +
+ "dc.status," +
+ "dc.latitude,\n" +
+ "dc.longitude \n" +
+ "from " +
+ "sys_talk_back_equipment dc " +
+ "JOIN sys_talk_back_equipment_info dcd ON dc.terminal_number like concat('%',dcd.terminal_number,'%')" +
+ "WHERE " +
+ "1=1" +
+ " <if test='query != null'> AND (dcd.name LIKE '%${query}%' OR dcd.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ "ORDER BY dc.receive_time " +
+ ") union all (" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.channelId,\n" +
+ "dc.`name`,\n" +
+ "3 as type," +
+ "dc.status," +
+ "dc.latitude," +
+ "dc.longitude " +
+ "from " +
+ "device_channel_police_camera dc " +
+ "JOIN device_channel_dept_police_camera dcd ON dc.id = dcd.device_channel_police_camera_id " +
+ "WHERE " +
+ "1=1" +
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ " order by dc.channelId desc " +
+ ") " +
+ " </script>"})
+ List<DeviceChannelVO> queryChannelsAllByOnline(String deviceId,
+ String parentChannelId,
+ String query,
+ Boolean hasSubChannel,
+ String dwbh,
+ Boolean online);
+
+ /**
+ * 查询巡逻路线数据
+ * @param id
+ * @return
+ */
+ @Select("select ST_ASTEXT(positions) from srjw.sys_range where id = #{id}")
+ String getRangeInfoById(@Param("id") String id);
+
+ /**
+ * 判断该点在哪个派出所
+ * @param point 点
+ * @return
+ */
+ @Select("SELECT police_station_id FROM srjw.police_station_info WHERE ST_Intersects(geom,ST_GeomFromText(${point},4326))")
+ List<Long> getPoliceStationInfo(@Param("point") String point);
+
+
+ /**
+ * 查询是否存在绑定关系数据
+ * @param id
+ * @param deptId
+ * @return
+ */
+ @Select("select count(*) from wvp.device_channel_dept where device_channel_id = #{id} and dept_id = #{deptId}")
+ int queryExistByDeptIdAndDeviceChannelId(@Param("id") Integer id,@Param("deptId") String deptId);
+
+
+ /**
+ * 更新绑定
+ * @param deviceChannelId
+ * @param deptId
+ */
+ @Insert("insert into wvp.device_channel_dept(device_channel_id,dept_id) values(#{deviceChannelId},#{deptId})")
+ void saveHandleBindPosition(@Param("deviceChannelId") Integer deviceChannelId,@Param("deptId") String deptId);
+
+
+ /**
+ * 更新绑定
+ * @param deviceChannelId
+ * @param deptId
+ */
+ @Update("update wvp.device_channel_dept set dept_id = #{deptId} where device_channel_id = #{deviceChannelId}")
+ void updateHandleBindPosition(@Param("deviceChannelId") Integer deviceChannelId,@Param("deptId") String deptId);
+
+ /**
+ * 查询手台列表数据
+ * @param deviceId
+ * @param o
+ * @param query
+ * @param hasSubChannel
+ * @param dwbh 单位编号
+ * @param online 是否在线
+ * @return
+ */
+ @Select(value = {" <script>" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.terminal_number as channelId,\n" +
+ "dcd.`name`,\n" +
+ "dc.status," +
+ "2 as type," +
+ "dc.latitude,\n" +
+ "dc.longitude\n" +
+ "from " +
+ "sys_talk_back_equipment dc " +
+ "JOIN sys_talk_back_equipment_info dcd ON dc.terminal_number like concat('%',dcd.terminal_number,'%')" +
+ "WHERE " +
+ "1=1" +
+ " <if test='query != null'> AND (dcd.name LIKE '%${query}%' OR dcd.terminal_number LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ "ORDER BY dc.receive_time " +
+ " </script>"})
+ List<DeviceChannelVO> queryTalkBackEquipment(String deviceId, Object o, String query, Boolean hasSubChannel, String dwbh, Boolean online);
+
+ /**
+ * 查询执法记录仪列表数据
+ * @param deviceId
+ * @param o
+ * @param query
+ * @param hasSubChannel
+ * @param dwbh 单位编号
+ * @param online 是否在线
+ * @return
+ */
+ @Select(value = {" <script>" +
+ "SELECT " +
+ "dc.id,\n" +
+ "dc.channelId,\n" +
+ "dc.`name`,\n" +
+ "dc.status," +
+ "3 as type," +
+ "dc.latitude," +
+ "dc.longitude " +
+ "from " +
+ "device_channel_police_camera dc " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " JOIN device_channel_dept_police_camera dcd ON dc.id = dcd.device_channel_police_camera_id " +
+ " </if> " +
+ "WHERE " +
+ "1=1" +
+ " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
+ " <if test=\"dwbh!=null and dwbh!='' and dwbh!='1123598813738675201'\">\n" +
+ " and dcd.dept_id = #{dwbh}\n" +
+ " </if> " +
+ " <if test='online == true' > AND dc.status=1</if>" +
+ " <if test='online == false' > AND dc.status=0</if>" +
+ "ORDER BY dc.channelId " +
+ " </script>"})
+ List<DeviceChannelVO> queryChannelsPoliceCamera(String deviceId, Object o, String query, Boolean hasSubChannel, String dwbh, Boolean online);
+
+ /**
+ * 查询派出所名称--摄像头,警车
+ * @param id 设备id
+ * @return
+ */
+ @Select("select bd.dept_name from device_channel_dept dcd join srjw.blade_dept bd on bd.id = dcd.dept_id where device_channel_id = #{id}")
+ String getDeptNameByDeviceChannelId(@Param("id") int id);
+
+ /**
+ * 查询派出所名称 -- 手台
+ * @param id 手台编号
+ * @return
+ */
+ @Select("select bd.dept_name from sys_talk_back_equipment_info dcd join srjw.blade_dept bd on bd.id = dcd.dept_id where terminal_number = #{id}")
+ String getDeptNameByTalkBackEquipmentId(@Param("id")String id);
+
+
+ /**
+ * 查询派出所名称--执法记录仪
+ * @param id 设备id
+ * @return
+ */
+ @Select("select bd.dept_name from device_channel_dept_police_camera dcd join srjw.blade_dept bd on bd.id = dcd.dept_id where device_channel_police_camera_id = #{id}")
+ String getDeptNameByDeviceChannelPoloiceCameraId(@Param("id")int id);
}
--
Gitblit v1.9.3