From d849352441eaf2ef3398eb25cd0f933ff59beec9 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 12 May 2023 10:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A5=E9=80=82=E9=85=8Dpo?= =?UTF-8?q?stgresql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 9 + sql/2.6.8升级2.6.9.sql | 476 ++++++++++++++++++ .../iot/vmp/gb28181/bean/Device.java | 10 +- .../iot/vmp/gb28181/bean/GbStream.java | 2 +- .../vmp/gb28181/bean/PlatformGbStream.java | 2 +- .../NotifyRequestForCatalogProcessor.java | 2 +- .../request/impl/NotifyRequestProcessor.java | 2 +- .../impl/RegisterRequestProcessor.java | 2 +- .../cmd/KeepaliveNotifyMessageHandler.java | 4 +- .../cmd/DeviceInfoResponseMessageHandler.java | 7 +- .../iot/vmp/media/zlm/dto/StreamPushItem.java | 60 +++ .../iot/vmp/service/IRecordInfoServer.java | 8 - .../vmp/service/impl/DeviceServiceImpl.java | 18 +- .../service/impl/RecordInfoServerImpl.java | 25 - .../service/impl/StreamProxyServiceImpl.java | 4 +- .../vmp/storager/dao/DeviceAlarmMapper.java | 24 +- .../vmp/storager/dao/DeviceChannelMapper.java | 430 +++++++--------- .../iot/vmp/storager/dao/DeviceMapper.java | 310 ++++++------ .../dao/DeviceMobilePositionMapper.java | 12 +- .../iot/vmp/storager/dao/GbStreamMapper.java | 102 ++-- .../iot/vmp/storager/dao/LogMapper.java | 13 +- .../vmp/storager/dao/MediaServerMapper.java | 126 ++--- .../storager/dao/ParentPlatformMapper.java | 82 +-- .../storager/dao/PlatformCatalogMapper.java | 25 +- .../storager/dao/PlatformChannelMapper.java | 70 +-- .../storager/dao/PlatformGbStreamMapper.java | 64 +-- .../iot/vmp/storager/dao/RecordInfoDao.java | 25 - .../iot/vmp/storager/dao/RoleMapper.java | 13 +- .../vmp/storager/dao/StreamProxyMapper.java | 42 +- .../vmp/storager/dao/StreamPushMapper.java | 96 ++-- .../iot/vmp/storager/dao/UserMapper.java | 38 +- .../storager/impl/RedisCatchStorageImpl.java | 2 +- .../vmp/web/gb28181/ApiDeviceController.java | 2 +- .../vmp/web/gb28181/ApiStreamController.java | 2 +- 34 files changed, 1265 insertions(+), 844 deletions(-) create mode 100644 sql/2.6.8升级2.6.9.sql delete mode 100644 src/main/java/com/genersoft/iot/vmp/service/IRecordInfoServer.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java diff --git a/pom.xml b/pom.xml index 5628ab37..90c385ce 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,15 @@ 8.0.30 + + + org.postgresql + postgresql + 42.5.1 + + + + com.github.pagehelper diff --git a/sql/2.6.8升级2.6.9.sql b/sql/2.6.8升级2.6.9.sql new file mode 100644 index 00000000..32baaa81 --- /dev/null +++ b/sql/2.6.8升级2.6.9.sql @@ -0,0 +1,476 @@ +alter table device + change deviceId device_id varchar(50) not null; + +alter table device + change streamMode stream_mode varchar(50) null; + +alter table device + change registerTime register_time varchar(50) null; + +alter table device + change keepaliveTime keepalive_time varchar(50) null; + +alter table device + change createTime create_time varchar(50) not null; + +alter table device + change updateTime update_time varchar(50) not null; + +alter table device + change subscribeCycleForCatalog subscribe_cycle_for_catalog bool default false; + +alter table device + change subscribeCycleForMobilePosition subscribe_cycle_for_mobile_position bool default false; + +alter table device + change mobilePositionSubmissionInterval mobile_position_submission_interval int default 5 not null; + +alter table device + change subscribeCycleForAlarm subscribe_cycle_for_alarm bool default false; + +alter table device + change hostAddress host_address varchar(50) null; + +alter table device + change ssrcCheck ssrc_check bool default false; + +alter table device + change geoCoordSys geo_coord_sys varchar(50) not null; + +alter table device + change treeType tree_type varchar(50) not null; + +alter table device + change mediaServerId media_server_id varchar(50) default 'auto' null; + +alter table device + change sdpIp sdp_ip varchar(50) null; + +alter table device + change localIp local_ip varchar(50) null; + +alter table device + change asMessageChannel as_message_channel bool default false; + +alter table device + change keepaliveIntervalTime keepalive_interval_time int null; + +alter table device_alarm + change deviceId device_id varchar(50) not null; + +alter table device_alarm + change channelId channel_id varchar(50) not null; + +alter table device_alarm + change alarmPriority alarm_priority varchar(50) not null; + +alter table device_alarm + change alarmMethod alarm_method varchar(50) null; + +alter table device_alarm + change alarmTime alarm_time varchar(50) not null; + +alter table device_alarm + change alarmDescription alarm_description varchar(255) null; + +alter table device_alarm + change alarmType alarm_type varchar(50) null; + +alter table device_alarm + change createTime create_time varchar(50) null; + +alter table device_channel + change channelId channel_id varchar(50) not null; + +alter table device_channel + change civilCode civil_code varchar(50) null; + +alter table device_channel + change parentId parent_id varchar(50) null; + +alter table device_channel + change safetyWay safety_way int null; + +alter table device_channel + change registerWay register_way int null; + +alter table device_channel + change certNum cert_num varchar(50) null; + +alter table device_channel + change errCode err_code int null; + +alter table device_channel + change endTime end_time varchar(50) null; + +alter table device_channel + change ipAddress ip_address varchar(50) null; + +alter table device_channel + change PTZType ptz_type int null; + +alter table device_channel + change status status bool default false; + +alter table device_channel + change streamId stream_id varchar(50) null; + +alter table device_channel + change deviceId device_id varchar(50) not null; + + +alter table device_channel + change hasAudio has_audio bool default false; + +alter table device_channel + change createTime create_time varchar(50) not null; + +alter table device_channel + change updateTime update_time varchar(50) not null; + +alter table device_channel + change subCount sub_count int default 0 null; + +alter table device_channel + change longitudeGcj02 longitude_gcj02 double null; + +alter table device_channel + change latitudeGcj02 latitude_gcj02 double null; + +alter table device_channel + change longitudeWgs84 longitude_wgs84 double null; + +alter table device_channel + change latitudeWgs84 latitude_wgs84 double null; + +alter table device_channel + change businessGroupId business_group_id varchar(50) null; + +alter table device_channel + change gpsTime gps_time varchar(50) null; + +alter table device_mobile_position + change deviceId device_id varchar(50) not null; + +alter table device_mobile_position + change channelId channel_id varchar(50) not null; + +alter table device_mobile_position + change deviceName device_name varchar(255) null; + +alter table device_mobile_position + change reportSource report_source varchar(50) null; + +alter table device_mobile_position + change longitudeGcj02 longitude_gcj02 double null; + +alter table device_mobile_position + change latitudeGcj02 latitude_gcj02 double null; + +alter table device_mobile_position + change longitudeWgs84 longitude_wgs84 double null; + +alter table device_mobile_position + change latitudeWgs84 latitude_wgs84 double null; + +alter table device_mobile_position + change createTime create_time varchar(50) null; + +alter table gb_stream + add constraint gb_stream_pk + primary key (gbStreamId); + +alter table gb_stream + change gbStreamId gb_stream_id int auto_increment; + +alter table gb_stream + change gbId gb_id varchar(50) not null; + +alter table gb_stream + change streamType stream_type varchar(50) null; + +alter table gb_stream + change mediaServerId media_server_id varchar(50) null; + +alter table gb_stream + change createTime create_time varchar(50) null; + +alter table log + change createTime create_time varchar(50) not null; + +alter table media_server + change hookIp hook_ip varchar(50) not null; + +alter table media_server + change sdpIp sdp_ip varchar(50) not null; + +alter table media_server + change streamIp stream_ip varchar(50) not null; + +alter table media_server + change httpPort http_port int not null; + +alter table media_server + change httpSSlPort http_ssl_port int not null; + +alter table media_server + change rtmpPort rtmp_port int not null; + +alter table media_server + change rtmpSSlPort rtmp_ssl_port int not null; + +alter table media_server + change rtpProxyPort rtp_proxy_port int not null; + +alter table media_server + change rtspPort rtsp_port int not null; + +alter table media_server + change rtspSSLPort rtsp_ssl_port int not null; + +alter table media_server + change autoConfig auto_config bool default true; + +alter table media_server + change rtpEnable rtp_enable bool default false; + +alter table media_server + change rtpPortRange rtp_port_range varchar(50) not null; + +alter table media_server + change recordAssistPort record_assist_port int not null; + +alter table media_server + change defaultServer default_server bool default false; + +alter table media_server + change createTime create_time varchar(50) not null; + +alter table media_server + change updateTime update_time varchar(50) not null; + +alter table media_server + change hookAliveInterval hook_alive_interval int not null; + +alter table parent_platform + change serverGBId server_gb_id varchar(50) not null; + +alter table parent_platform + change serverGBDomain server_gb_domain varchar(50) null; + +alter table parent_platform + change serverIP server_ip varchar(50) null; + +alter table parent_platform + change serverPort server_port int null; + +alter table parent_platform + change deviceGBId device_gb_id varchar(50) not null; + +alter table parent_platform + change deviceIp device_ip varchar(50) null; + +alter table parent_platform + change devicePort device_port varchar(50) null; + +alter table parent_platform + change keepTimeout keep_timeout varchar(50) null; + +alter table parent_platform + change characterSet character_set varchar(50) null; + +alter table parent_platform + change catalogId catalog_id varchar(50) not null; + +alter table parent_platform + change startOfflinePush start_offline_push bool default false; + +alter table parent_platform + change administrativeDivision administrative_division varchar(50) not null; + +alter table parent_platform + change catalogGroup catalog_group int default 1 null; + +alter table parent_platform + change createTime create_time varchar(50) null; + +alter table parent_platform + change updateTime update_time varchar(50) null; + +alter table parent_platform + change treeType tree_type varchar(50) not null; + +alter table parent_platform + change asMessageChannel as_message_channel bool default false; + +alter table parent_platform + change enable enable bool default false; + +alter table parent_platform + change ptz ptz bool default false; + +alter table parent_platform + change rtcp rtcp bool default false; + +alter table parent_platform + change status status bool default false; + +alter table parent_platform + change status status bool default false; + +alter table platform_catalog + change platformId platform_id varchar(50) not null; + +alter table platform_catalog + change parentId parent_id varchar(50) null; + +alter table platform_catalog + change civilCode civil_code varchar(50) null; + +alter table platform_catalog + change businessGroupId business_group_id varchar(50) null; + +alter table platform_gb_channel + change platformId platform_id varchar(50) not null; + +alter table platform_gb_channel + change catalogId catalog_id varchar(50) not null; + +alter table platform_gb_channel + change deviceChannelId device_channel_id int not null; + +alter table platform_gb_stream + change platformId platform_id varchar(50) not null; + +alter table platform_gb_stream + change catalogId catalog_id varchar(50) not null; + +alter table platform_gb_stream + change gbStreamId gb_stream_id int not null; + +alter table stream_proxy + change mediaServerId media_server_id varchar(50) null; + +alter table stream_proxy + change createTime create_time varchar(50) not null; + +alter table stream_proxy + change updateTime update_time varchar(50) null; + +alter table stream_proxy + change enable_remove_none_reader enable_remove_none_reader bool default false; + +alter table stream_proxy + change enable_disable_none_reader enable_disable_none_reader bool default false; + +alter table stream_proxy + change enable_audio enable_audio bool default false; + +alter table stream_proxy + change enable_mp4 enable_mp4 bool default false; + +alter table stream_proxy + change enable enable bool default false; + +alter table stream_push + change totalReaderCount total_reader_count varchar(50) null; + +alter table stream_push + change originType origin_type int null; + +alter table stream_push + change originTypeStr origin_type_str varchar(50) null; + +alter table stream_push + change createTime create_time varchar(50) null; + +alter table stream_push + change aliveSecond alive_second int null; + +alter table stream_push + change mediaServerId media_server_id varchar(50) null; + +alter table stream_push + change status status bool default false; + + +alter table stream_push + change serverId server_id varchar(50) not null; + +alter table stream_push + change pushTime push_time varchar(50) null; + +alter table stream_push + change updateTime update_time varchar(50) null; + +alter table stream_push + change pushIng push_ing bool default false; + +alter table stream_push + change status status bool default false; + +alter table stream_push + change self self bool default false; + +alter table user + change roleId role_id int not null; + +alter table user + change createTime create_time varchar(50) not null; + +alter table user + change updateTime update_time varchar(50) not null; + +alter table user + change pushKey push_key varchar(50) null; + +alter table user_role + change createTime create_time varchar(50) not null; + +alter table user_role + change updateTime update_time varchar(50) not null; + +rename table device to wvp_device; +rename table device_alarm to wvp_device_alarm; +rename table device_channel to wvp_device_channel; +rename table device_mobile_position to wvp_device_mobile_position; +rename table gb_stream to wvp_gb_stream; +rename table log to wvp_log; +rename table media_server to wvp_media_server; +rename table parent_platform to wvp_platform; +rename table platform_catalog to wvp_platform_catalog; +rename table platform_gb_channel to wvp_platform_gb_channel; +rename table platform_gb_stream to wvp_platform_gb_stream; +rename table stream_proxy to wvp_stream_proxy; +rename table stream_push to wvp_stream_push; +rename table user to wvp_user; +rename table user_role to wvp_user_role; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java index daf709f9..db8463ae 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java @@ -77,8 +77,8 @@ public class Device { /** * 在线 */ - @Schema(description = "是否在线,1为在线,0为离线") - private int online; + @Schema(description = "是否在线,true为在线,false为离线") + private boolean online; /** @@ -140,7 +140,7 @@ public class Device { /** * 目录订阅周期,0为不订阅 */ - @Schema(description = "目录订阅周期,0为不订阅") + @Schema(description = "目录订阅周期,o为不订阅") private int subscribeCycleForCatalog; /** @@ -286,11 +286,11 @@ public class Device { this.hostAddress = hostAddress; } - public int getOnline() { + public boolean isOnline() { return online; } - public void setOnline(int online) { + public void setOnline(boolean online) { this.online = online; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java index d1e4ccbd..67058f39 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java @@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema; public class GbStream extends PlatformGbStream{ @Schema(description = "ID") - private Integer gbStreamId; + private int gbStreamId; @Schema(description = "应用名") private String app; @Schema(description = "流ID") diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java index d52cf7bd..f7402b6f 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java @@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; public class PlatformGbStream { @Schema(description = "ID") - private Integer gbStreamId; + private int gbStreamId; @Schema(description = "平台ID") private String platformId; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java index b9a41a57..9ed6c782 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java @@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); Device device = redisCatchStorage.getDevice(deviceId); - if (device == null || device.getOnline() == 0) { + if (device == null || !device.isOnline()) { logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index 5dae8261..4e8325f5 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); Device device = redisCatchStorage.getDevice(deviceId); - if (device == null || device.getOnline() == 0) { + if (device == null || !device.isOnline()) { logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java index 3e1c673c..e1fc32e8 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java @@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen device.setGeoCoordSys("WGS84"); device.setTreeType("CivilCode"); device.setDeviceId(deviceId); - device.setOnline(0); + device.setOnline(false); } device.setIp(remoteAddressInfo.getIp()); device.setPort(remoteAddressInfo.getPort()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java index 4d1a58e2..e064969e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java @@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp device.setKeepaliveTime(DateUtil.getNow()); - if (device.getOnline() == 1) { + if (device.isOnline()) { deviceService.updateDevice(device); }else { // 对于已经离线的设备判断他的注册是否已经过期 if (!deviceService.expire(device)){ - device.setOnline(0); + device.setOnline(false); deviceService.online(device, null); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java index 496fd940..9dca6c6d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java @@ -1,18 +1,13 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; -import com.genersoft.iot.vmp.common.VideoManagerConstants; -import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; import com.genersoft.iot.vmp.service.IDeviceService; -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import gov.nist.javax.sip.message.SIPRequest; import org.dom4j.DocumentException; import org.dom4j.Element; @@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent public void handForDevice(RequestEvent evt, Device device, Element rootElement) { logger.debug("接收到DeviceInfo应答消息"); // 检查设备是否存在, 不存在则不回复 - if (device == null || device.getOnline() == 0) { + if (device == null || !device.isOnline()) { logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]:" + (device != null ? device.getDeviceId():"" )); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java index ddcfbdd9..6befe46f 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java @@ -325,5 +325,65 @@ public class StreamPushItem extends GbStream implements Comparable getRecordList(int page, int count); -} diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index a0d120c6..1f46cc63 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -118,7 +118,7 @@ public class DeviceServiceImpl implements IDeviceService { // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 if (device.getCreateTime() == null) { - device.setOnline(1); + device.setOnline(true); device.setCreateTime(now); logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); deviceMapper.add(device); @@ -130,8 +130,8 @@ public class DeviceServiceImpl implements IDeviceService { } sync(device); }else { - if(device.getOnline() == 0){ - device.setOnline(1); + if(!device.isOnline()){ + device.setOnline(true); device.setCreateTime(now); deviceMapper.update(device); redisCatchStorage.updateDevice(device); @@ -185,7 +185,7 @@ public class DeviceServiceImpl implements IDeviceService { } String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId; dynamicTask.stop(registerExpireTaskKey); - device.setOnline(0); + device.setOnline(false); redisCatchStorage.updateDevice(device); deviceMapper.update(device); //进行通道离线 @@ -231,7 +231,7 @@ public class DeviceServiceImpl implements IDeviceService { } logger.info("[移除目录订阅]: {}", device.getDeviceId()); String taskKey = device.getDeviceId() + "catalog"; - if (device.getOnline() == 1) { + if (device.isOnline()) { Runnable runnable = dynamicTask.get(taskKey); if (runnable instanceof ISubscribeTask) { ISubscribeTask subscribeTask = (ISubscribeTask) runnable; @@ -264,7 +264,7 @@ public class DeviceServiceImpl implements IDeviceService { } logger.info("[移除移动位置订阅]: {}", device.getDeviceId()); String taskKey = device.getDeviceId() + "mobile_position"; - if (device.getOnline() == 1) { + if (device.isOnline()) { Runnable runnable = dynamicTask.get(taskKey); if (runnable instanceof ISubscribeTask) { ISubscribeTask subscribeTask = (ISubscribeTask) runnable; @@ -331,7 +331,7 @@ public class DeviceServiceImpl implements IDeviceService { @Override public void checkDeviceStatus(Device device) { - if (device == null || device.getOnline() == 0) { + if (device == null || !device.isOnline()) { return; } try { @@ -535,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService { if (haveChannel) { // 查询那些civilCode不在通道中的不规范通道,放置在根目录 - List nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId); + List nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId); if (nonstandardNode != null && nonstandardNode.size() > 0) { result.addAll(nonstandardNode); } @@ -568,7 +568,7 @@ public class DeviceServiceImpl implements IDeviceService { @Override public void addDevice(Device device) { - device.setOnline(0); + device.setOnline(false); device.setCreateTime(DateUtil.getNow()); device.setUpdateTime(DateUtil.getNow()); deviceMapper.addCustomDevice(device); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java deleted file mode 100644 index 49083639..00000000 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.genersoft.iot.vmp.service.impl; - -import com.genersoft.iot.vmp.service.IRecordInfoServer; -import com.genersoft.iot.vmp.storager.dao.RecordInfoDao; -import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -public class RecordInfoServerImpl implements IRecordInfoServer { - - @Autowired - private RecordInfoDao recordInfoDao; - - @Override - public PageInfo getRecordList(int page, int count) { - PageHelper.startPage(page, count); - List all = recordInfoDao.selectAll(); - return new PageInfo<>(all); - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index 02f4f914..bb99651f 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @Override public void zlmServerOnline(String mediaServerId) { // 移除开启了无人观看自动移除的流 - List streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); + List streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId); if (streamProxyItemList.size() > 0) { gbStreamMapper.batchDel(streamProxyItemList); } @@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @Override public void zlmServerOffline(String mediaServerId) { // 移除开启了无人观看自动移除的流 - List streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); + List streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId); if (streamProxyItemList.size() > 0) { gbStreamMapper.batchDel(streamProxyItemList); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java index f927d51e..28a2e913 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java @@ -16,32 +16,32 @@ import java.util.List; @Repository public interface DeviceAlarmMapper { - @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + + @Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " + "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})") int add(DeviceAlarm alarm); @Select( value = {" "}) List query(String deviceId, String alarmPriority, String alarmMethod, String alarmType, String startTime, String endTime); @Delete(" " ) 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 f81d1f87..7940011d 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 @@ -18,10 +18,10 @@ import java.util.List; @Repository public interface DeviceChannelMapper { - @Insert("INSERT INTO device_channel (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, longitudeGcj02, latitudeGcj02, " + - "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + + @Insert("INSERT INTO wvp_device_channel (channel_id, device_id, name, manufacture, model, owner, civil_code, block, " + + "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " + + "ip_address, port, password, ptz_type, status, stream_id, longitude, latitude, longitude_gcj02, latitude_gcj02, " + + "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time) " + "VALUES (#{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}, #{longitudeGcj02}, " + @@ -29,39 +29,39 @@ public interface DeviceChannelMapper { int add(DeviceChannel channel); @Update(value = {" "}) int update(DeviceChannel channel); @@ -69,42 +69,42 @@ public interface DeviceChannelMapper { "SELECT " + "dc.* " + "from " + - "device_channel dc " + + "wvp_device_channel dc " + "WHERE " + - "dc.deviceId = #{deviceId} " + -" AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%')) " + - " AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) " + + "dc.device_id = #{deviceId} " + +" AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%')) " + + " AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) " + " AND dc.status=1" + " AND dc.status=0" + - " AND dc.subCount > 0 " + - " AND dc.subCount = 0 " + - " AND dc.channelId in " + + " AND dc.sub_count > 0 " + + " AND dc.sub_count = 0 " + + " AND dc.channel_id in " + "#{item} " + " " + - "ORDER BY dc.channelId " + + "ORDER BY dc.channel_id " + " "}) List queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List channelIds); @Select(value = {" "}) List queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List channelIds); @@ -112,151 +112,97 @@ public interface DeviceChannelMapper { @Select(value = {" "}) List queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List channelIds, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); - @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") + @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") DeviceChannel queryChannel(String deviceId, String channelId); - @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId}") + @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}") int cleanChannelsByDeviceId(String deviceId); - @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") + @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") int del(String deviceId, String channelId); - @Update(value = {"UPDATE device_channel SET streamId=null WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) + @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) void stopPlay(String deviceId, String channelId); - @Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) + @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) void startPlay(String deviceId, String channelId, String streamId); @Select(value = {" "}) List queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); @Select(value = {" "}) List queryChannelByPlatformId(String platformId); - @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") + @Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}") List queryChannelByChannelId( String channelId); - @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) + @Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) void offline(String deviceId, String channelId); - @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"}) + @Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE device_id=#{deviceId}"}) void offlineByDeviceId(String deviceId); -// @Insert("") -// int batchAdd(List addChannels); - - @Insert("") int batchAddOrUpdate(List addChannels); - @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) + @Update(value = {"UPDATE wvp_device_channel SET status=1 WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) void online(String deviceId, String channelId); @Update({""}) int batchUpdate(List updateChannels); - @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1") + @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND status=1") List queryOnlineChannelsByDeviceId(String deviceId); @Delete(value = {" "}) int cleanChannelsNotInList(String deviceId, List channels); - @Update(" update device_channel" + - " set subCount = (select *" + + @Update(" update wvp_device_channel" + + " set sub_count = (select *" + " from (select count(0)" + - " from device_channel" + - " where deviceId = #{deviceId} and parentId = #{channelId}) as temp)" + - " where deviceId = #{deviceId} " + - " and channelId = #{channelId}") + " from wvp_device_channel" + + " where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" + + " where device_id = #{deviceId} " + + " and channel_id = #{channelId}") int updateChannelSubCount(String deviceId, String channelId); @Update(value = {" "}) void updatePosition(DeviceChannel deviceChannel); - @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") + @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0") List getAllChannelInPlay(); - @Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}") + @Select("select * from wvp_device_channel where longitude*latitude > 0 and device_id = #{deviceId}") List getAllChannelWithCoordinate(String deviceId); @Select(value = {" "}) List getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); @Select(value = {" "}) List getChannelsByCivilCode(String deviceId, String parentId); - @Select("select min(length(channelId)) as minLength " + - "from device_channel " + - "where deviceId=#{deviceId}") + @Select("select min(length(channel_id)) as minLength " + + "from wvp_device_channel " + + "where device_id=#{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 getChannelWithoutCiviCode(String deviceId); + @Select("select * from wvp_device_channel where device_id=#{deviceId} and civil_code not in " + + "(select civil_code from wvp_device_channel where device_id=#{deviceId} group by civil_code)") + List getChannelWithoutCivilCode(String deviceId); - @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") + @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") List 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}") + @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " + + " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " + + " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " + + " dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " + + " from wvp_device_channel dc" + + " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" + + " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" + + " where pgc.platform_id=#{serverGBId}") List queryChannelWithCatalog(String serverGBId); - @Select("select * from device_channel where deviceId = #{deviceId}") + @Select("select * from wvp_device_channel where device_id = #{deviceId}") List queryAllChannels(String deviceId); - @Select("select count(1) as total, sum(status) as online from device_channel") + @Select("select count(1) as total, sum(status) as online from wvp_device_channel") ResourceBaceInfo getOverview(); @Select("select channelId" + - ", deviceId" + + ", device_id" + ", latitude" + - ", longitude" + - ", latitudeWgs84" + - ", longitudeWgs84" + - ", latitudeGcj02" + - ", longitudeGcj02 " + - "from device_channel where deviceId = #{deviceId} " + + ", longitude"+ + ",latitude_wgs84"+ + ",longitude_wgs84"+ + ",latitude_gcj02"+ + ",longitude_gcj02"+ + "from wvp_device_channel where device_id = #{deviceId} " + "and latitude != 0 " + "and longitude != 0 " + - "and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)") + "and(latitude_gcj02=0orlatitude_wgs84=0orlongitude_wgs84= 0 or longitude_gcj02 = 0)") List getChannelsWithoutTransform(String deviceId); - @Select("select de.* from device de left join device_channel dc on de.deviceId = dc.deviceId where dc.channelId=#{channelId}") + @Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}") List getDeviceByChannelId(String channelId); @Delete({""}) int batchDel(List deleteChannelList); @Update({""}) int batchOnline(List channels); @Update({""}) int batchOffline(List channels); 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 fe739ea9..ebf2933c 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 @@ -15,68 +15,68 @@ import java.util.List; public interface DeviceMapper { @Select("SELECT " + - "deviceId, " + + "device_id, " + "coalesce(custom_name, name) as name, " + "password, " + "manufacturer, " + "model, " + "firmware, " + "transport," + - "streamMode," + + "stream_mode," + "ip," + - "sdpIp," + - "localIp," + + "sdp_ip," + + "local_ip," + "port," + - "hostAddress," + + "host_address," + "expires," + - "registerTime," + - "keepaliveTime," + - "createTime," + - "updateTime," + + "register_time," + + "keepalive_time," + + "create_time," + + "update_time," + "charset," + - "subscribeCycleForCatalog," + - "subscribeCycleForMobilePosition," + - "mobilePositionSubmissionInterval," + - "subscribeCycleForAlarm," + - "ssrcCheck," + - "asMessageChannel," + - "geoCoordSys," + - "treeType," + + "subscribe_cycle_for_catalog," + + "subscribe_cycle_for_mobile_position," + + "mobile_position_submission_interval," + + "subscribe_cycle_for_alarm," + + "ssrc_check," + + "as_message_channel," + + "geo_coord_sys," + + "tree_type," + "online," + - "mediaServerId," + - "(SELECT count(0) FROM device_channel WHERE deviceId=device.deviceId) as channelCount "+ - " FROM device WHERE deviceId = #{deviceId}") + "media_server_id," + + "(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+ + " FROM wvp_device WHERE device_id = #{deviceId}") Device getDeviceByDeviceId(String deviceId); - @Insert("INSERT INTO device (" + - "deviceId, " + + @Insert("INSERT INTO wvp_device (" + + "device_id, " + "name, " + "manufacturer, " + "model, " + "firmware, " + "transport," + - "streamMode," + + "stream_mode," + "ip," + - "sdpIp," + - "localIp," + + "sdp_ip," + + "local_ip," + "port," + - "hostAddress," + + "host_address," + "expires," + - "registerTime," + - "keepaliveTime," + - "keepaliveIntervalTime," + - "createTime," + - "updateTime," + + "register_time," + + "keepalive_time," + + "keepalive_interval_time," + + "create_time," + + "update_time," + "charset," + - "subscribeCycleForCatalog," + - "subscribeCycleForMobilePosition," + - "mobilePositionSubmissionInterval," + - "subscribeCycleForAlarm," + - "ssrcCheck," + - "asMessageChannel," + - "geoCoordSys," + - "treeType," + - "online" + + "subscribe_cycle_for_catalog," + + "subscribe_cycle_for_mobile_position,"+ + "mobile_position_submission_interval,"+ + "subscribe_cycle_for_alarm,"+ + "ssrc_check,"+ + "as_message_channel,"+ + "geo_coord_sys,"+ + "tree_type,"+ + "online"+ ") VALUES (" + "#{deviceId}," + "#{name}," + @@ -110,167 +110,167 @@ public interface DeviceMapper { int add(Device device); @Update(value = {" "}) int update(Device device); @Select( " " ) List getDevices(Boolean online); - @Delete("DELETE FROM device WHERE deviceId=#{deviceId}") + @Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}") int del(String deviceId); @Select("SELECT " + - "deviceId, " + + "device_id, " + "coalesce(custom_name, name) as name, " + "password, " + "manufacturer, " + "model, " + "firmware, " + "transport," + - "streamMode," + + "stream_mode," + "ip," + - "sdpIp," + - "localIp," + - "port," + - "hostAddress," + - "expires," + - "registerTime," + - "keepaliveTime," + - "createTime," + - "updateTime," + - "charset," + - "subscribeCycleForCatalog," + - "subscribeCycleForMobilePosition," + - "mobilePositionSubmissionInterval," + - "subscribeCycleForAlarm," + - "ssrcCheck," + - "asMessageChannel," + - "geoCoordSys," + - "treeType," + - "online " + - " FROM device WHERE online = 1") + "sdp_ip,"+ + "local_ip,"+ + "port,"+ + "host_address,"+ + "expires,"+ + "register_time,"+ + "keepalive_time,"+ + "create_time,"+ + "update_time,"+ + "charset,"+ + "subscribe_cycle_for_catalog,"+ + "subscribe_cycle_for_mobile_position,"+ + "mobile_position_submission_interval,"+ + "subscribe_cycle_for_alarm,"+ + "ssrc_check,"+ + "as_message_channel,"+ + "geo_coord_sys,"+ + "tree_type,"+ + "online"+ + " FROM wvp_device WHERE online = true") List getOnlineDevices(); @Select("SELECT " + - "deviceId, " + - "coalesce(custom_name, name) as name, " + - "password, " + - "manufacturer, " + - "model, " + - "firmware, " + - "transport," + - "streamMode," + - "ip," + - "sdpIp," + - "localIp," + - "port," + - "hostAddress," + - "expires," + - "registerTime," + - "keepaliveTime," + - "createTime," + - "updateTime," + - "charset," + - "subscribeCycleForCatalog," + - "subscribeCycleForMobilePosition," + - "mobilePositionSubmissionInterval," + - "subscribeCycleForAlarm," + - "ssrcCheck," + - "asMessageChannel," + - "geoCoordSys," + - "treeType," + - "online" + - " FROM device WHERE ip = #{host} AND port=#{port}") + "device_id,"+ + "coalesce(custom_name,name)as name,"+ + "password,"+ + "manufacturer,"+ + "model,"+ + "firmware,"+ + "transport,"+ + "stream_mode,"+ + "ip,"+ + "sdp_ip,"+ + "local_ip,"+ + "port,"+ + "host_address,"+ + "expires,"+ + "register_time,"+ + "keepalive_time,"+ + "create_time,"+ + "update_time,"+ + "charset,"+ + "subscribe_cycle_for_catalog,"+ + "subscribe_cycle_for_mobile_position,"+ + "mobile_position_submission_interval,"+ + "subscribe_cycle_for_alarm,"+ + "ssrc_check,"+ + "as_message_channel,"+ + "geo_coord_sys,"+ + "tree_type,"+ + "online"+ + " FROM wvp_device WHERE ip = #{host} AND port=#{port}") Device getDeviceByHostAndPort(String host, int port); @Update(value = {" "}) void updateCustom(Device device); - @Insert("INSERT INTO device (" + - "deviceId, " + - "custom_name, " + - "password, " + - "sdpIp, " + - "createTime," + - "updateTime," + - "charset," + - "ssrcCheck," + - "asMessageChannel," + - "geoCoordSys," + - "treeType," + - "online," + - "mediaServerId" + + @Insert("INSERT INTO wvp_device (" + + "device_id,"+ + "custom_name,"+ + "password,"+ + "sdp_ip,"+ + "create_time,"+ + "update_time,"+ + "charset,"+ + "ssrc_check,"+ + "as_message_channel,"+ + "geo_coord_sys,"+ + "tree_type,"+ + "online,"+ + "media_server_id"+ ") VALUES (" + "#{deviceId}," + "#{name}," + @@ -288,12 +288,12 @@ public interface DeviceMapper { ")") void addCustomDevice(Device device); - @Select("select count(1) as total, sum(online) as online from device") + @Select("select count(1) as total, sum(online) as online FROM wvp_device") ResourceBaceInfo getOverview(); - @Select("select * from device") + @Select("select * FROM wvp_device") List getAll(); - @Select("select * from device where asMessageChannel = 1") + @Select("select * FROM wvp_device where as_message_channel = true") List queryDeviceWithAsMessageChannel(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java index 3c77024b..dbc9a167 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java @@ -11,25 +11,25 @@ import java.util.List; @Mapper public interface DeviceMobilePositionMapper { - @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + + @Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+ "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})") int insertNewPosition(MobilePosition mobilePosition); @Select(value = {" "}) List queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime); - @Select("SELECT * FROM device_mobile_position WHERE deviceId = #{deviceId}" + + @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" + " ORDER BY time DESC LIMIT 1") MobilePosition queryLatestPositionByDevice(String deviceId); - @Delete("DELETE FROM device_mobile_position WHERE deviceId = #{deviceId}") + @Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}") int clearMobilePositionsByDeviceId(String deviceId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java index 49101bdd..5f8702c7 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java @@ -14,94 +14,94 @@ import java.util.List; @Repository public interface GbStreamMapper { - @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + - "longitude, latitude, streamType, mediaServerId, createTime) VALUES" + + @Insert("REPLACE INTO wvp_gb_stream (app, stream, gb_id, name, " + + "longitude, latitude, stream_type,media_server_id,create_time) VALUES" + "(#{app}, #{stream}, #{gbId}, #{name}, " + "#{longitude}, #{latitude}, #{streamType}, " + "#{mediaServerId}, #{createTime})") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") int add(GbStream gbStream); - @Update("UPDATE gb_stream " + + @Update("UPDATE wvp_gb_stream " + "SET app=#{app}," + "stream=#{stream}," + - "gbId=#{gbId}," + + "gb_id=#{gbId}," + "name=#{name}," + - "streamType=#{streamType}," + + "stream_type=#{streamType}," + "longitude=#{longitude}, " + "latitude=#{latitude}," + - "mediaServerId=#{mediaServerId}" + + "media_server_id=#{mediaServerId}" + "WHERE app=#{app} AND stream=#{stream}") int updateByAppAndStream(GbStream gbStream); - @Update("UPDATE gb_stream " + + @Update("UPDATE wvp_gb_stream " + "SET app=#{app}," + "stream=#{stream}," + - "gbId=#{gbId}," + + "gb_id=#{gbId}," + "name=#{name}," + - "streamType=#{streamType}," + + "stream_type=#{streamType}," + "longitude=#{longitude}, " + "latitude=#{latitude}," + - "mediaServerId=#{mediaServerId}" + - "WHERE gbStreamId=#{gbStreamId}") + "media_server_id=#{mediaServerId}" + + "WHERE gb_stream_id=#{gbStreamId}") int update(GbStream gbStream); - @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") + @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") int del(String app, String stream); @Select("") List selectAll(String platformId, String catalogId, String query, String mediaServerId); - @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") + @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") GbStream selectOne(String app, String stream); - @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") + @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}") List selectByGBId(String gbId); - @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + - "WHERE gs.gbId = #{gbId} AND pgs.platformId = #{platformId}") + @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " + + "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " + + "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}") GbStream queryStreamInPlatform(String platformId, String gbId); @Select("") List queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus); - @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " + - "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") + @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " + + "ON gs.gb_stream_id = pgs.gb_stream_id WHERE pgs.gb_stream_id is NULL") List queryStreamNotInPlatform(); - @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") + @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}") void deleteWithoutGBId(String type, String mediaServerId); @Delete(""}) int updateStreamGPS(List gpsMsgInfos); @Select("") List selectAllForAppAndStream(List streamPushItems); - @Update("UPDATE gb_stream " + - "SET mediaServerId=#{mediaServerId}" + + @Update("UPDATE wvp_gb_stream " + + "SET media_server_id=#{mediaServerId}" + "WHERE app=#{app} AND stream=#{stream}") void updateMediaServer(String app, String stream, String mediaServerId); @Update("") int updateGbIdOrName(List streamPushItemForUpdate); - @Select("SELECT status FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") + @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}") Boolean selectStatusForProxy(String app, String stream); - @Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}") + @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}") Boolean selectStatusForPush(String app, String stream); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java index fb1b4e30..ae8471b2 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java @@ -1,6 +1,5 @@ package com.genersoft.iot.vmp.storager.dao; -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; import com.genersoft.iot.vmp.storager.dao.dto.LogDto; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; @@ -17,21 +16,21 @@ import java.util.List; @Repository public interface LogMapper { - @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " + + @Insert("insert into wvp_log ( name,type,uri,address,result,timing,username,create_time) " + "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})") int add(LogDto logDto); @Select(value = {""}) List query(String query, String type, String startTime, String endTime); - @Delete("DELETE FROM log") + @Delete("DELETE FROM wvp_log") int clear(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java index 97e74ae8..ca0d98d0 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java @@ -11,28 +11,28 @@ import java.util.List; @Repository public interface MediaServerMapper { - @Insert("INSERT INTO media_server (" + - "id, " + - "ip, " + - "hookIp, " + - "sdpIp, " + - "streamIp, " + - "httpPort, " + - "httpSSlPort, " + - "rtmpPort, " + - "rtmpSSlPort, " + - "rtpProxyPort, " + - "rtspPort, " + - "rtspSSLPort, " + - "autoConfig, " + - "secret, " + - "rtpEnable, " + - "rtpPortRange, " + - "recordAssistPort, " + - "defaultServer, " + - "createTime, " + - "updateTime, " + - "hookAliveInterval" + + @Insert("INSERT INTO wvp_media_server (" + + "id,"+ + "ip,"+ + "hook_ip,"+ + "sdp_ip,"+ + "stream_ip,"+ + "http_port,"+ + "http_ssl_port,"+ + "rtmp_port,"+ + "rtmp_ssl_port,"+ + "rtp_proxy_port,"+ + "rtsp_port,"+ + "rtsp_ssl_port,"+ + "auto_config,"+ + "secret,"+ + "rtp_enable,"+ + "rtp_port_range,"+ + "record_assist_port,"+ + "default_server,"+ + "create_time,"+ + "update_time,"+ + "hook_alive_interval"+ ") VALUES " + "(" + "#{id}, " + @@ -59,70 +59,70 @@ public interface MediaServerMapper { int add(MediaServerItem mediaServerItem); @Update(value = {" "}) int update(MediaServerItem mediaServerItem); @Update(value = {" "}) int updateByHostAndPort(MediaServerItem mediaServerItem); - @Select("SELECT * FROM media_server WHERE id=#{id}") + @Select("SELECT * FROM wvp_media_server WHERE id=#{id}") MediaServerItem queryOne(String id); - @Select("SELECT * FROM media_server") + @Select("SELECT * FROM wvp_media_server") List queryAll(); - @Delete("DELETE FROM media_server WHERE id=#{id}") + @Delete("DELETE FROM wvp_media_server WHERE id=#{id}") void delOne(String id); - @Select("DELETE FROM media_server WHERE ip=#{host} and httpPort=#{port}") + @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") void delOneByIPAndPort(String host, int port); - @Delete("DELETE FROM media_server WHERE defaultServer=1") + @Delete("DELETE FROM wvp_media_server WHERE default_server=true") int delDefault(); - @Select("SELECT * FROM media_server WHERE ip=#{host} and httpPort=#{port}") + @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") MediaServerItem queryOneByHostAndPort(String host, int port); - @Select("SELECT * FROM media_server WHERE defaultServer=1") + @Select("SELECT * FROM wvp_media_server WHERE default_server=true") MediaServerItem queryDefault(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java index 89ebd69f..056b409c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java @@ -14,88 +14,88 @@ import java.util.List; @Repository public interface ParentPlatformMapper { - @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + - " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " + - " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + + @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+ + "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,"+ + "status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time,tree_type) " + " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " + " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") int addParentPlatform(ParentPlatform parentPlatform); - @Update("UPDATE parent_platform " + + @Update("UPDATE wvp_platform " + "SET enable=#{enable}, " + "name=#{name}," + - "deviceGBId=#{deviceGBId}," + - "serverGBId=#{serverGBId}, " + - "serverGBDomain=#{serverGBDomain}, " + - "serverIP=#{serverIP}," + - "serverPort=#{serverPort}, " + - "deviceIp=#{deviceIp}, " + - "devicePort=#{devicePort}, " + + "device_gb_id=#{deviceGBId}," + + "server_gb_id=#{serverGBId}, " + + "server_gb_domain=#{serverGBDomain}, " + + "server_ip=#{serverIP}," + + "server_port=#{serverPort}, " + + "device_ip=#{deviceIp}, " + + "device_port=#{devicePort}, " + "username=#{username}, " + "password=#{password}, " + "expires=#{expires}, " + - "keepTimeout=#{keepTimeout}, " + + "keep_timeout=#{keepTimeout}, " + "transport=#{transport}, " + - "characterSet=#{characterSet}, " + + "character_set=#{characterSet}, " + "ptz=#{ptz}, " + "rtcp=#{rtcp}, " + - "asMessageChannel=#{asMessageChannel}, " + + "as_message_channel=#{asMessageChannel}, " + "status=#{status}, " + - "startOfflinePush=#{startOfflinePush}, " + - "catalogGroup=#{catalogGroup}, " + - "administrativeDivision=#{administrativeDivision}, " + - "createTime=#{createTime}, " + - "updateTime=#{updateTime}, " + - "treeType=#{treeType}, " + - "catalogId=#{catalogId} " + + "start_offline_push=#{startOfflinePush}, " + + "catalog_group=#{catalogGroup}, " + + "administrative_division=#{administrativeDivision}, " + + "create_time=#{createTime}, " + + "update_time=#{updateTime}, " + + "tree_type=#{treeType}, " + + "catalog_id=#{catalogId} " + "WHERE id=#{id}") int updateParentPlatform(ParentPlatform parentPlatform); - @Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}") + @Delete("DELETE FROM wvp_platform WHERE server_gb_id=#{serverGBId}") int delParentPlatform(ParentPlatform parentPlatform); @Select("SELECT *, ((SELECT count(0)\n" + - " FROM platform_gb_channel pc\n" + - " WHERE pc.platformId = pp.serverGBId)\n" + + " FROM wvp_platform_gb_channel pc\n" + + " WHERE pc.platform_id = pp.server_gb_id)\n" + " +\n" + " (SELECT count(0)\n" + - " FROM platform_gb_stream pgs\n" + - " WHERE pgs.platformId = pp.serverGBId)\n" + + " FROM wvp_platform_gb_stream pgs\n" + + " WHERE pgs.platform_id = pp.server_gb_id)\n" + " +\n" + " (SELECT count(0)\n" + - " FROM platform_catalog pgc\n" + - " WHERE pgc.platformId = pp.serverGBId)) as channelCount\n" + - "FROM parent_platform pp ") + " FROM wvp_platform_catalog pgc\n" + + " WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" + + "FROM wvp_platform pp ") List getParentPlatformList(); - @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") + @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ") List getEnableParentPlatformList(boolean enable); - @Select("SELECT * FROM parent_platform WHERE enable=1 and asMessageChannel = 1") + @Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true") List queryEnablePlatformListWithAsMessageChannel(); - @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") + @Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}") ParentPlatform getParentPlatByServerGBId(String platformGbId); - @Select("SELECT * FROM parent_platform WHERE id=#{id}") + @Select("SELECT * FROM wvp_platform WHERE id=#{id}") ParentPlatform getParentPlatById(int id); - @Update("UPDATE parent_platform SET status=false" ) + @Update("UPDATE wvp_platform SET status=false" ) int outlineForAllParentPlatform(); - @Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" ) + @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" ) int updateParentPlatformStatus(String platformGbID, boolean online); @Update(value = {" "}) int setDefaultCatalog(String platformId, String catalogId, String updateTime); - @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " + + @Select("select 'channel' as name, count(pgc.platform_id) count from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id where pgc.platform_id=#{platform_id} and dc.channel_id =#{gbId} " + "union " + - "select 'stream' as name, count(pgs.platformId) count from platform_gb_stream pgs left join gb_stream gs on pgs.gbStreamId = gs.gbStreamId where pgs.platformId=#{platformId} and gs.gbId = #{gbId}") - List getChannelSource(String platformId, String gbId); + "select 'stream' as name, count(pgs.platform_id) count from wvp_platform_gb_stream pgs left join wvp_gb_stream gs on pgs.gb_stream_id = gs.gb_stream_id where pgs.platform_id=#{platform_id} and gs.gb_id #{gbId}") + List getChannelSource(String platform_id, String gbId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java index f0baf9e9..784b0ea7 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java @@ -1,10 +1,7 @@ package com.genersoft.iot.vmp.storager.dao; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; -import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; -import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; @@ -15,22 +12,22 @@ import java.util.List; @Repository public interface PlatformCatalogMapper { - @Insert("INSERT INTO platform_catalog (id, name, platformId, parentId, civilCode, businessGroupId) VALUES" + + @Insert("INSERT INTO platform_catalog (id, name, platform_id, parent_id, civil_code, business_group_id) VALUES" + "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})") int add(PlatformCatalog platformCatalog); - @Delete("DELETE FROM platform_catalog WHERE id=#{id}") + @Delete("DELETE from wvp_platform_catalog WHERE id=#{id}") int del(String id); - @Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") + @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}") int delByPlatformId(String platformId); - @Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " + - "left join platform_catalog pc2 on pc.id = pc2.parentId " + - "WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id") + @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " + + "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " + + "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} group by pc.id") List selectByParentId(String platformId, String parentId); - @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") + @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.id=#{id}") PlatformCatalog select(String id); @Update(value = {" "}) int update(PlatformCatalog platformCatalog); - @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.platformId=#{platformId}") + @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}") List selectByPlatForm(String platformId); - @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalogId from parent_platform pp WHERE pp.serverGBId=#{platformId})") + @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})") PlatformCatalog selectDefaultByPlatFormId(String platformId); @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}") PlatformCatalog selectParentCatalog(String id); - @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'1' as parental, pc.parentId " + - " FROM platform_catalog pc WHERE pc.platformId=#{platformId}") + @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " + + " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}") List queryCatalogInPlatform(String platformId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java index ae130cf9..3aeb0e0c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java @@ -21,13 +21,13 @@ public interface PlatformChannelMapper { * 查询列表里已经关联的 */ @Select("") List findChannelRelatedPlatform(String platformId, List channelReduces); @Insert("") int delChannelForGB(String platformId, List channelReducesToDel); @Delete("") int delChannelForDeviceId(String deviceId); @Delete("") int cleanChannelForGB(String platformId); - @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId=#{channelId} and pgc.platformId=#{platformId}") + @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") List queryChannelInParentPlatform(String platformId, String channelId); - @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") + @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List queryAllChannelInCatalog(String platformId, String catalogId); - @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + - " from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " + - " where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") + @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + + " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " + + " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); @Select("select d.*\n" + - "from platform_gb_channel pgc\n" + - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" + - " left join device d on dc.deviceId = d.deviceId\n" + - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") + "from wvp_platform_gb_channel pgc\n" + + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + + " left join wvp_device d on dc.device_id = d.device_id\n" + + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); @Delete("") int delByCatalogId(String id); @Delete("") int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); @@ -86,35 +86,35 @@ public interface PlatformChannelMapper { "SELECT " + "pp.* " + "FROM " + - "parent_platform pp " + - "left join platform_gb_channel pgc on " + - "pp.serverGBId = pgc.platformId " + - "left join device_channel dc on " + - "dc.id = pgc.deviceChannelId " + + "wvp_platform pp " + + "left join wvp_platform_gb_channel pgc on " + + "pp.server_gb_id = pgc.platform_id " + + "left join wvp_device_channel dc on " + + "dc.id = pgc.device_channel_id " + "WHERE " + - "dc.channelId = #{channelId} and pp.status = true " + - "AND pp.serverGBId IN" + - " #{item}" + + "dc.channel_id = #{channelId} and pp.status = true " + + "AND pp.server_gb_id IN" + + " #{item}" + " ") List queryPlatFormListForGBWithGBId(String channelId, List platforms); @Delete("") void delByPlatformId(String serverGBId); @Delete("") int delChannelForGBByCatalogId(String platformId, String catalogId); - @Select("select dc.channelId deviceId,dc.name,d.manufacturer,d.model,d.firmware\n" + - "from platform_gb_channel pgc\n" + - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" + - " left join device d on dc.deviceId = d.deviceId\n" + - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") + @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + + "from wvp_platform_gb_channel pgc\n" + + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + + " left join wvp_device d on dc.device_id = d.device_id\n" + + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId); - @Select("SELECT pgc.platformId FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}'") + @Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'") List queryParentPlatformByChannelId(String channelId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index 91a4a5f4..0b198554 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -16,82 +16,82 @@ import java.util.List; @Repository public interface PlatformGbStreamMapper { - @Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" + + @Insert("REPLACE INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" + "( #{gbStreamId}, #{platformId}, #{catalogId})") int add(PlatformGbStream platformGbStream); @Insert("") int batchAdd(List streamPushItems); - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbStreamId from gb_stream where app=#{app} AND stream=#{stream})") + @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select gb_stream_id from wvp_gb_stream where app=#{app} AND stream=#{stream})") int delByAppAndStream(String app, String stream); - @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") + @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}") int delByPlatformId(String platformId); @Select("SELECT " + "pp.* " + "FROM " + - "platform_gb_stream pgs " + - "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + - "LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " + + "wvp_platform_gb_stream pgs " + + "LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " + + "LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " + "WHERE " + "gs.app =#{app} " + "AND gs.stream =#{stream} ") List selectByAppAndStream(String app, String stream); - @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + - "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId " + - "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}") + @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " + + "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " + + "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{serverGBId}") StreamProxyItem selectOne(String app, String stream, String serverGBId); @Select("select gs.* \n" + - "from gb_stream gs\n" + - " left join platform_gb_stream pgs\n" + - " on gs.gbStreamId = pgs.gbStreamId\n" + - "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") + "from wvp_gb_stream gs\n" + + " left join wvp_platform_gb_stream pgs\n" + + " on gs.gb_stream_id = pgs.gb_stream_id\n" + + "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") List queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); - @Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" + - "from gb_stream gs\n" + - " left join platform_gb_stream pgs\n" + - " on gs.gbStreamId = pgs.gbStreamId\n" + - "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") + @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" + + "from wvp_gb_stream gs\n" + + " left join wvp_platform_gb_stream pgs\n" + + " on gs.gb_stream_id = pgs.gb_stream_id\n" + + "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") List queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); - @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") + @Delete("DELETE from wvp_platform_gb_stream WHERE catalog_id=#{id}") int delByCatalogId(String id); @Select(" ") List queryPlatFormListForGBWithGBId(String app, String stream, List platforms); - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select id from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}") + @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select id from wvp_gb_stream where app=#{app} AND stream=#{stream}) AND platform_id=#{platformId}") int delByAppAndStreamAndPlatform(String app, String stream, String platformId); @Delete("") void delByAppAndStreamsByPlatformId(List gbStreams, String platformId); - @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}") + @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}") int delByPlatformAndCatalogId(String platformId, String catalogId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java deleted file mode 100644 index a784472f..00000000 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.genersoft.iot.vmp.storager.dao; - -import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Mapper -@Repository -public interface RecordInfoDao { - - @Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" + - "(#{app}, #{stream}, #{mediaServerId}, datetime('now','localtime')), #{type}, #{deviceId}, #{channelId}, #{name}") - int add(RecordInfo recordInfo); - - @Delete("DELETE FROM user WHERE createTime < #{beforeTime}") - int deleteBefore(String beforeTime); - - @Select("select * FROM recordInfo") - List selectAll(); -} diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java index 425f5e42..3df74696 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java @@ -1,7 +1,6 @@ package com.genersoft.iot.vmp.storager.dao; import com.genersoft.iot.vmp.storager.dao.dto.Role; -import com.genersoft.iot.vmp.storager.dao.dto.User; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; @@ -11,25 +10,25 @@ import java.util.List; @Repository public interface RoleMapper { - @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + + @Insert("INSERT INTO wvp_user_role (name, authority, create_time, update_time) VALUES" + "(#{name}, #{authority}, #{createTime}, #{updateTime})") int add(Role role); @Update(value = {" "}) int update(Role role); - @Delete("DELETE FROM user_role WHERE id != 1 and id=#{id}") + @Delete("DELETE from wvp_user_role WHERE id != 1 and id=#{id}") int delete(int id); - @Select("select * FROM user_role WHERE id=#{id}") + @Select("select * from wvp_user_role WHERE id=#{id}") Role selectById(int id); - @Select("select * FROM user_role") + @Select("select * from wvp_user_role") List selectAll(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java index 5dbd8f04..ec6d870f 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java @@ -11,20 +11,20 @@ import java.util.List; @Repository public interface StreamProxyMapper { - @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " + - "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" + + @Insert("INSERT INTO wvp_stream_proxy (type, name, app, stream,media_server_id, url, src_url, dst_url, " + + "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" + "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " + "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " + "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )") int add(StreamProxyItem streamProxyDto); - @Update("UPDATE stream_proxy " + + @Update("UPDATE wvp_stream_proxy " + "SET type=#{type}, " + "name=#{name}," + "app=#{app}," + "stream=#{stream}," + "url=#{url}, " + - "mediaServerId=#{mediaServerId}, " + + "media_server_id=#{mediaServerId}, " + "src_url=#{src_url}," + "dst_url=#{dst_url}, " + "timeout_ms=#{timeout_ms}, " + @@ -39,44 +39,44 @@ public interface StreamProxyMapper { "WHERE app=#{app} AND stream=#{stream}") int update(StreamProxyItem streamProxyDto); - @Delete("DELETE FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") + @Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}") int del(String app, String stream); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createTime desc") + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.create_time desc") List selectAll(); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=#{enable} order by st.createTime desc") + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=#{enable} order by st.create_time desc") List selectForEnable(boolean enable); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.createTime desc") + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc") StreamProxyItem selectOne(String app, String stream); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + - "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + - "WHERE st.enable=#{enable} and st.mediaServerId = #{id} order by st.createTime desc") + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + + "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc") List selectForEnableInMediaServer(String id, boolean enable); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + - "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + - "WHERE st.mediaServerId = #{id} order by st.createTime desc") + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + + "WHERE st.media_server_id= #{id} order by st.create_time desc") List selectInMediaServer(String id); - @Update("UPDATE stream_proxy " + + @Update("UPDATE wvp_stream_proxy " + "SET status=#{status} " + - "WHERE mediaServerId=#{mediaServerId}") + "WHERE media_server_id=#{mediaServerId}") void updateStatusByMediaServerId(String mediaServerId, boolean status); - @Update("UPDATE stream_proxy " + + @Update("UPDATE wvp_stream_proxy " + "SET status=#{status} " + "WHERE app=#{app} AND stream=#{stream}") int updateStatus(String app, String stream, boolean status); - @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") + @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}") void deleteAutoRemoveItemByMediaServerId(String mediaServerId); - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.mediaServerId=#{mediaServerId} order by st.createTime desc") - List selecAutoRemoveItemByMediaServerId(String mediaServerId); + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.media_server_id=#{mediaServerId} order by st.create_time desc") + List selectAutoRemoveItemByMediaServerId(String mediaServerId); - @Select("select count(1) as total, sum(status) as online from stream_proxy") + @Select("select count(1) as total, sum(status) as online from wvp_stream_proxy") ResourceBaceInfo getOverview(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java index 492dfe38..fefdab33 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java @@ -5,18 +5,16 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import org.apache.ibatis.annotations.*; -// import org.omg.PortableInterceptor.INACTIVE; import org.springframework.stereotype.Repository; -import java.util.Collection; import java.util.List; @Mapper @Repository public interface StreamPushMapper { - @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + - "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + + @Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + + "push_time, alive_second, media_server_id, server_id, update_time, create_time, push_ing, self) VALUES" + "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " + "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " + "#{pushIng}, #{self} )") @@ -24,33 +22,33 @@ public interface StreamPushMapper { @Update(value = {" "}) int update(StreamPushItem streamPushItem); - @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") + @Delete("DELETE FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}") int del(String app, String stream); @Delete("") int delAllWithoutGBId(List streamPushItems); @Delete(""}) List selectAllForList(String query, Boolean pushing, String mediaServerId); - @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createTime desc") + @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.create_time desc") List selectAll(); - @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") + @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") StreamPushItem selectOne(String app, String stream); @Insert("") void online(List onlineStreams); - @Select("SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where sp.status = 1") + @Select("SELECT gs.* FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where sp.status = true") List getOnlinePusherForGb(); - @Update("UPDATE stream_push SET status=0") + @Update("UPDATE wvp_stream_push SET status=0") void setAllStreamOffline(); - @Select("SELECT CONCAT(app,stream) FROM gb_stream") + @Select("SELECT CONCAT(app,stream) from wvp_gb_stream") List getAllAppAndStream(); @Select(value = {" "}) ResourceBaceInfo getOverview(boolean pushIngAsOnline); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java index ecaa165a..89b9d861 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java @@ -10,56 +10,56 @@ import java.util.List; @Repository public interface UserMapper { - @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + + @Insert("INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time) VALUES" + "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})") int add(User user); @Update(value = {" "}) int update(User user); - @Delete("DELETE FROM user WHERE id != 1 and id=#{id}") + @Delete("DELETE from wvp_user WHERE id != 1 and id=#{id}") int delete(int id); - @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username} AND u.password=#{password}") + @Select("select u.*, r.id as role_id, r.name as roleName, r.authority as roleAuthority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username} AND u.password=#{password}") @Results(id = "roleMap", value = { - @Result(column = "roleID", property = "role.id"), - @Result(column = "roleName", property = "role.name"), - @Result(column = "roleAuthority", property = "role.authority"), - @Result(column = "roleCreateTime", property = "role.createTime"), - @Result(column = "roleUpdateTime", property = "role.updateTime") + @Result(column = "role_id", property = "role.id"), + @Result(column = "role_name", property = "role.name"), + @Result(column = "role_authority", property = "role.authority"), + @Result(column = "role_create_time", property = "role.createTime"), + @Result(column = "role_update_time", property = "role.updateTime") }) User select(String username, String password); - @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.id=#{id}") + @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.id=#{id}") @ResultMap(value="roleMap") User selectById(int id); - @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username}") + @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username}") @ResultMap(value="roleMap") User getUserByUsername(String username); - @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id") + @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id") @ResultMap(value="roleMap") List selectAll(); - @Select("select * from (select user.*, concat(concat(#{callId}, '_'), pushKey) as str1 from user) as u where md5(u.str1) = #{sign}") + @Select("select * from (select user.*, concat(concat(#{call_id}, '_'), push_key) as str1 from wvp_user) as u where md5(u.str1) = #{sign}") List checkPushAuthorityByCallIdAndSign(String callId, String sign); - @Select("select * from user where md5(pushKey) = #{sign}") + @Select("select * from wvp_user where md5(push_key) = #{sign}") List checkPushAuthorityByCallId(String sign); - @Select("select u.id, u.username,u.pushKey,u.roleId, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u join user_role r on u.roleId=r.id") + @Select("select u.id, u.username,u.push_key,u.role_id, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u join wvp_user_role r on u.role_id=r.id") @ResultMap(value="roleMap") List getUsers(); - @Update("update user set pushKey=#{pushKey} where id=#{id}") + @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}") int changePushKey(int id, String pushKey); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index 98327ab4..c5bc207a 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -561,7 +561,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public boolean deviceIsOnline(String deviceId) { - return getDevice(deviceId).getOnline() == 1; + return getDevice(deviceId).isOnline(); } diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java index 08f79bf4..aded8bf1 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java @@ -90,7 +90,7 @@ public class ApiDeviceController { deviceJsonObject.put("RecvStreamIP", ""); deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期 deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅 - deviceJsonObject.put("Online", device.getOnline() == 1); + deviceJsonObject.put("Online", device.isOnline()); deviceJsonObject.put("Password", ""); deviceJsonObject.put("MediaTransport", device.getTransport()); deviceJsonObject.put("RemoteIP", device.getIp()); diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java index 8e35d04f..90dd6862 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java @@ -92,7 +92,7 @@ public class ApiStreamController { result.put("error","device[ " + serial + " ]未找到"); resultDeferredResult.setResult(result); return resultDeferredResult; - }else if (device.getOnline() == 0) { + }else if (!device.isOnline()) { JSONObject result = new JSONObject(); result.put("error","device[ " + code + " ]offline"); resultDeferredResult.setResult(result);