| | |
| | | <version>8.0.30</version> |
| | | </dependency> |
| | | |
| | | <!--postgresql--> |
| | | <dependency> |
| | | <groupId>org.postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | <version>42.5.1</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | <!--Mybatiså页æä»¶ --> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | /** |
| | | * å¨çº¿ |
| | | */ |
| | | @Schema(description = "æ¯å¦å¨çº¿ï¼1为å¨çº¿ï¼0为离线") |
| | | private int online; |
| | | @Schema(description = "æ¯å¦å¨çº¿ï¼true为å¨çº¿ï¼false为离线") |
| | | private boolean online; |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ç®å½è®¢é
卿ï¼0为ä¸è®¢é
|
| | | */ |
| | | @Schema(description = "ç®å½è®¢é
卿ï¼0为ä¸è®¢é
") |
| | | @Schema(description = "ç®å½è®¢é
卿ï¼o为ä¸è®¢é
") |
| | | private int subscribeCycleForCatalog; |
| | | |
| | | /** |
| | |
| | | this.hostAddress = hostAddress; |
| | | } |
| | | |
| | | public int getOnline() { |
| | | public boolean isOnline() { |
| | | return online; |
| | | } |
| | | |
| | | public void setOnline(int online) { |
| | | public void setOnline(boolean online) { |
| | | this.online = online; |
| | | } |
| | | |
| | |
| | | public class GbStream extends PlatformGbStream{ |
| | | |
| | | @Schema(description = "ID") |
| | | private Integer gbStreamId; |
| | | private int gbStreamId; |
| | | @Schema(description = "åºç¨å") |
| | | private String app; |
| | | @Schema(description = "æµID") |
| | |
| | | public class PlatformGbStream { |
| | | |
| | | @Schema(description = "ID") |
| | | private Integer gbStreamId; |
| | | private int gbStreamId; |
| | | |
| | | @Schema(description = "å¹³å°ID") |
| | | private String platformId; |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | device.setGeoCoordSys("WGS84"); |
| | | device.setTreeType("CivilCode"); |
| | | device.setDeviceId(deviceId); |
| | | device.setOnline(0); |
| | | device.setOnline(false); |
| | | } |
| | | device.setIp(remoteAddressInfo.getIp()); |
| | | device.setPort(remoteAddressInfo.getPort()); |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | public void setSelf(boolean self) { |
| | | this.self = self; |
| | | } |
| | | |
| | | // @Override |
| | | // public Integer getGbStreamId() { |
| | | // return super.getGbStreamId(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void setGbStreamId(Integer gbStreamId) { |
| | | // super.setGbStreamId(gbStreamId); |
| | | // } |
| | | // |
| | | // |
| | | // public String getGbId() { |
| | | // return super.getGbId(); |
| | | // } |
| | | // |
| | | // public void setGbId(String gbId) { |
| | | // super.setGbId(gbId); |
| | | // } |
| | | // |
| | | // public String getName() { |
| | | // return super.getName(); |
| | | // } |
| | | // |
| | | // public void setName(String name) { |
| | | // super.setName(name); |
| | | // } |
| | | // |
| | | // public double getLongitude() { |
| | | // return super.getLongitude(); |
| | | // } |
| | | // |
| | | // public void setLongitude(double longitude) { |
| | | // super.setLongitude(longitude); |
| | | // } |
| | | // |
| | | // public double getLatitude() { |
| | | // return super.getLatitude(); |
| | | // } |
| | | // |
| | | // public void setLatitude(double latitude) { |
| | | // super.setLatitude(latitude); |
| | | // } |
| | | // |
| | | // public String getStreamType() { |
| | | // return super.getStreamType(); |
| | | // } |
| | | // |
| | | // public void setStreamType(String streamType) { |
| | | // super.setStreamType(streamType); |
| | | // } |
| | | // |
| | | // public boolean isStatus() { |
| | | // return super.isStatus(); |
| | | // } |
| | | // |
| | | // public void setStatus(boolean status) { |
| | | // super.setStatus(status); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | // ç¬¬ä¸æ¬¡ä¸çº¿ æå设å¤ä¹åæ¯ç¦»çº¿ç¶æ--è¿è¡éé忥å设å¤ä¿¡æ¯æ¥è¯¢ |
| | | if (device.getCreateTime() == null) { |
| | | device.setOnline(1); |
| | | device.setOnline(true); |
| | | device.setCreateTime(now); |
| | | logger.info("[设å¤ä¸çº¿,馿¬¡æ³¨å]: {}ï¼æ¥è¯¢è®¾å¤ä¿¡æ¯ä»¥åééä¿¡æ¯", device.getDeviceId()); |
| | | deviceMapper.add(device); |
| | |
| | | } |
| | | 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); |
| | |
| | | } |
| | | String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId; |
| | | dynamicTask.stop(registerExpireTaskKey); |
| | | device.setOnline(0); |
| | | device.setOnline(false); |
| | | redisCatchStorage.updateDevice(device); |
| | | deviceMapper.update(device); |
| | | //è¿è¡éé离线 |
| | |
| | | } |
| | | 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; |
| | |
| | | } |
| | | 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; |
| | |
| | | |
| | | @Override |
| | | public void checkDeviceStatus(Device device) { |
| | | if (device == null || device.getOnline() == 0) { |
| | | if (device == null || !device.isOnline()) { |
| | | return; |
| | | } |
| | | try { |
| | |
| | | |
| | | if (haveChannel) { |
| | | // æ¥è¯¢é£äºcivilCodeä¸å¨ééä¸çä¸è§èééï¼æ¾ç½®å¨æ ¹ç®å½ |
| | | List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId); |
| | | List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId); |
| | | if (nonstandardNode != null && nonstandardNode.size() > 0) { |
| | | result.addAll(nonstandardNode); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void addDevice(Device device) { |
| | | device.setOnline(0); |
| | | device.setOnline(false); |
| | | device.setCreateTime(DateUtil.getNow()); |
| | | device.setUpdateTime(DateUtil.getNow()); |
| | | deviceMapper.addCustomDevice(device); |
| | |
| | | @Override |
| | | public void zlmServerOnline(String mediaServerId) { |
| | | // ç§»é¤å¼å¯äºæ 人è§çèªå¨ç§»é¤çæµ |
| | | List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); |
| | | List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId); |
| | | if (streamProxyItemList.size() > 0) { |
| | | gbStreamMapper.batchDel(streamProxyItemList); |
| | | } |
| | |
| | | @Override |
| | | public void zlmServerOffline(String mediaServerId) { |
| | | // ç§»é¤å¼å¯äºæ 人è§çèªå¨ç§»é¤çæµ |
| | | List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); |
| | | List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId); |
| | | if (streamProxyItemList.size() > 0) { |
| | | gbStreamMapper.batchDel(streamProxyItemList); |
| | | } |
| | |
| | | @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 = {" <script>" + |
| | | " SELECT * FROM device_alarm " + |
| | | " SELECT * FROM wvp_device_alarm " + |
| | | " WHERE 1=1 " + |
| | | " <if test=\"deviceId != null\" > AND deviceId = #{deviceId}</if>" + |
| | | " <if test=\"alarmPriority != null\" > AND alarmPriority = #{alarmPriority} </if>" + |
| | | " <if test=\"alarmMethod != null\" > AND alarmMethod = #{alarmMethod} </if>" + |
| | | " <if test=\"alarmType != null\" > AND alarmType = #{alarmType} </if>" + |
| | | " <if test=\"startTime != null\" > AND alarmTime >= #{startTime} </if>" + |
| | | " <if test=\"endTime != null\" > AND alarmTime <= #{endTime} </if>" + |
| | | " ORDER BY alarmTime ASC " + |
| | | " <if test=\"deviceId != null\" > AND device_id = #{deviceId}</if>" + |
| | | " <if test=\"alarmPriority != null\" > AND alarm_priority = #{alarmPriority} </if>" + |
| | | " <if test=\"alarmMethod != null\" > AND alarm_method = #{alarmMethod} </if>" + |
| | | " <if test=\"alarmType != null\" > AND alarm_type = #{alarmType} </if>" + |
| | | " <if test=\"startTime != null\" > AND alarm_time >= #{startTime} </if>" + |
| | | " <if test=\"endTime != null\" > AND alarm_time <= #{endTime} </if>" + |
| | | " ORDER BY alarm_time ASC " + |
| | | " </script>"}) |
| | | List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, |
| | | String alarmType, String startTime, String endTime); |
| | | |
| | | |
| | | @Delete(" <script>" + |
| | | "DELETE FROM device_alarm WHERE 1=1 " + |
| | | " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " + |
| | | "DELETE FROM wvp_device_alarm WHERE 1=1 " + |
| | | " <if test=\"deviceIdList != null and id == null \" > AND device_id in " + |
| | | "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| | | "</if>" + |
| | | " <if test=\"time != null and id == null \" > AND alarmTime <= #{time}</if>" + |
| | | " <if test=\"time != null and id == null \" > AND alarm_time <= #{time}</if>" + |
| | | " <if test=\"id != null\" > AND id = #{id}</if>" + |
| | | " </script>" |
| | | ) |
| | |
| | | @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}, " + |
| | |
| | | int add(DeviceChannel channel); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE device_channel " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "UPDATE wvp_device_channel " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test='name != null'>, name=#{name}</if>" + |
| | | "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + |
| | | "<if test='model != null'>, model=#{model}</if>" + |
| | | "<if test='owner != null'>, owner=#{owner}</if>" + |
| | | "<if test='civilCode != null'>, civilCode=#{civilCode}</if>" + |
| | | "<if test='civilCode != null'>, civil_code=#{civilCode}</if>" + |
| | | "<if test='block != null'>, block=#{block}</if>" + |
| | | "<if test='address != null'>, address=#{address}</if>" + |
| | | "<if test='parental != null'>, parental=#{parental}</if>" + |
| | | "<if test='parentId != null'>, parentId=#{parentId}</if>" + |
| | | "<if test='safetyWay != null'>, safetyWay=#{safetyWay}</if>" + |
| | | "<if test='registerWay != null'>, registerWay=#{registerWay}</if>" + |
| | | "<if test='certNum != null'>, certNum=#{certNum}</if>" + |
| | | "<if test='parentId != null'>, parent_id=#{parentId}</if>" + |
| | | "<if test='safetyWay != null'>, safety_way=#{safetyWay}</if>" + |
| | | "<if test='registerWay != null'>, register_way=#{registerWay}</if>" + |
| | | "<if test='certNum != null'>, cert_num=#{certNum}</if>" + |
| | | "<if test='certifiable != null'>, certifiable=#{certifiable}</if>" + |
| | | "<if test='errCode != null'>, errCode=#{errCode}</if>" + |
| | | "<if test='errCode != null'>, err_code=#{errCode}</if>" + |
| | | "<if test='secrecy != null'>, secrecy=#{secrecy}</if>" + |
| | | "<if test='ipAddress != null'>, ipAddress=#{ipAddress}</if>" + |
| | | "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + |
| | | "<if test='port != null'>, port=#{port}</if>" + |
| | | "<if test='password != null'>, password=#{password}</if>" + |
| | | "<if test='PTZType != null'>, PTZType=#{PTZType}</if>" + |
| | | "<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" + |
| | | "<if test='status != null'>, status=#{status}</if>" + |
| | | "<if test='streamId != null'>, streamId=#{streamId}</if>" + |
| | | "<if test='hasAudio != null'>, hasAudio=#{hasAudio}</if>" + |
| | | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + |
| | | "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + |
| | | "<if test='longitude != null'>, longitude=#{longitude}</if>" + |
| | | "<if test='latitude != null'>, latitude=#{latitude}</if>" + |
| | | "<if test='longitudeGcj02 != null'>, longitudeGcj02=#{longitudeGcj02}</if>" + |
| | | "<if test='latitudeGcj02 != null'>, latitudeGcj02=#{latitudeGcj02}</if>" + |
| | | "<if test='longitudeWgs84 != null'>, longitudeWgs84=#{longitudeWgs84}</if>" + |
| | | "<if test='latitudeWgs84 != null'>, latitudeWgs84=#{latitudeWgs84}</if>" + |
| | | "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" + |
| | | "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" + |
| | | "WHERE deviceId=#{deviceId} AND channelId=#{channelId}"+ |
| | | "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" + |
| | | "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" + |
| | | "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" + |
| | | "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" + |
| | | "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" + |
| | | "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" + |
| | | "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+ |
| | | " </script>"}) |
| | | int update(DeviceChannel channel); |
| | | |
| | |
| | | "SELECT " + |
| | | "dc.* " + |
| | | "from " + |
| | | "device_channel dc " + |
| | | "wvp_device_channel dc " + |
| | | "WHERE " + |
| | | "dc.deviceId = #{deviceId} " + |
| | | " <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " + |
| | | "dc.device_id = #{deviceId} " + |
| | | " <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) </if> " + |
| | | " <if test='online == true' > AND dc.status=1</if>" + |
| | | " <if test='online == false' > AND dc.status=0</if>" + |
| | | " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | "#{item} " + |
| | | "</foreach> </if>" + |
| | | "ORDER BY dc.channelId " + |
| | | "ORDER BY dc.channel_id " + |
| | | " </script>"}) |
| | | List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); |
| | | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | "dc.*, " + |
| | | "de.name as deviceName, " + |
| | | "de.online as deviceOnline " + |
| | | "de.name as device_name, " + |
| | | "de.online as device_online " + |
| | | "from " + |
| | | "device_channel dc " + |
| | | "LEFT JOIN device de ON dc.deviceId = de.deviceId " + |
| | | "wvp_device_channel dc " + |
| | | "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " + |
| | | "WHERE 1=1" + |
| | | " <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " + |
| | | " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + |
| | | " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + |
| | | " <if test='device_id != null'> AND dc.device_id = #{deviceId} </if> " + |
| | | " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + |
| | | " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " + |
| | | " <if test='online == true' > AND dc.status=1</if>" + |
| | | " <if test='online == false' > AND dc.status=0</if>" + |
| | | " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | "#{item} " + |
| | | "</foreach> </if>" + |
| | | "ORDER BY dc.channelId ASC" + |
| | | "ORDER BY dc.channel_id ASC" + |
| | | " </script>"}) |
| | | List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); |
| | | |
| | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | "dc.*, " + |
| | | "de.name as deviceName, " + |
| | | "de.online as deviceOnline " + |
| | | "de.name as device_name, " + |
| | | "de.online as device_online " + |
| | | "from " + |
| | | "device_channel dc " + |
| | | "LEFT JOIN device de ON dc.deviceId = de.deviceId " + |
| | | "wvp_device_channel dc " + |
| | | "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " + |
| | | "WHERE 1=1" + |
| | | " <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " + |
| | | " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + |
| | | " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + |
| | | " <if test='deviceId != null'> AND dc.device_id = #{deviceId} </if> " + |
| | | " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + |
| | | " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " + |
| | | " <if test='online == true' > AND dc.status=1</if>" + |
| | | " <if test='online == false' > AND dc.status=0</if>" + |
| | | " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" + |
| | | " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" + |
| | | "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + |
| | | "#{item} " + |
| | | "</foreach> </if>" + |
| | | "ORDER BY dc.channelId ASC " + |
| | | "ORDER BY dc.channel_id ASC " + |
| | | "Limit #{limit} OFFSET #{start}" + |
| | | " </script>"}) |
| | | List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> 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 = {" <script>" + |
| | | "SELECT " + |
| | | " dc.id,\n" + |
| | | " dc.channelId,\n" + |
| | | " dc.deviceId,\n" + |
| | | " dc.channel_id,\n" + |
| | | " dc.device_id,\n" + |
| | | " dc.name,\n" + |
| | | " de.manufacturer,\n" + |
| | | " de.hostAddress,\n" + |
| | | " dc.subCount,\n" + |
| | | " pgc.platformId as platformId,\n" + |
| | | " pgc.catalogId as catalogId " + |
| | | " FROM device_channel dc " + |
| | | " LEFT JOIN device de ON dc.deviceId = de.deviceId " + |
| | | " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + |
| | | " de.host_address,\n" + |
| | | " dc.sub_count,\n" + |
| | | " pgc.platform_id as platform_id,\n" + |
| | | " pgc.catalog_id as catalog_id " + |
| | | " FROM wvp_device_channel dc " + |
| | | " LEFT JOIN wvp_device de ON dc.device_id = de.device_id " + |
| | | " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " + |
| | | " WHERE 1=1 " + |
| | | " <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='online == true' > AND dc.status=1</if> " + |
| | | " <if test='online == false' > AND dc.status=0</if> " + |
| | | " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + |
| | | " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " + |
| | | " <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + |
| | | " <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + |
| | | " ORDER BY dc.deviceId, dc.channelId ASC" + |
| | | " <if test='hasSubChannel!= null and has_sub_channel == true' > AND dc.sub_count > 0</if> " + |
| | | " <if test='hasSubChannel!= null and has_sub_channel == false' > AND dc.sub_count = 0</if> " + |
| | | " <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_gb_channel where platform_id=#{platformId} ) </if> " + |
| | | " <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " + |
| | | " ORDER BY dc.device_id, dc.channel_id ASC" + |
| | | " </script>"}) |
| | | List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); |
| | | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | " dc.*,\n" + |
| | | " pgc.platformId as platformId,\n" + |
| | | " pgc.catalogId as catalogId " + |
| | | " FROM device_channel dc " + |
| | | " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + |
| | | " WHERE pgc.platformId = #{platformId} " + |
| | | " ORDER BY dc.deviceId, dc.channelId ASC" + |
| | | " pgc.platform_id as platform_id,\n" + |
| | | " pgc.catalog_id as catalog_id " + |
| | | " FROM wvp_device_channel dc " + |
| | | " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " + |
| | | " WHERE pgc.platform_id = #{platformId} " + |
| | | " ORDER BY dc.device_id, dc.channel_id ASC" + |
| | | " </script>"}) |
| | | List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId); |
| | | |
| | | |
| | | @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") |
| | | @Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}") |
| | | List<DeviceChannel> 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("<script> " + |
| | | // "insert into device_channel " + |
| | | // "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + |
| | | // " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| | | // " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + |
| | | // " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + |
| | | // "values " + |
| | | // "<foreach collection='addChannels' index='index' item='item' separator=','> " + |
| | | // "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + |
| | | // "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + |
| | | // "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + |
| | | // "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + |
| | | // "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + |
| | | // "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + |
| | | // "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + |
| | | // "#{item.businessGroupId}, #{item.gpsTime}) " + |
| | | // "</foreach> " + |
| | | // "ON DUPLICATE KEY UPDATE " + |
| | | // "updateTime=VALUES(updateTime), " + |
| | | // "name=VALUES(name), " + |
| | | // "manufacture=VALUES(manufacture), " + |
| | | // "model=VALUES(model), " + |
| | | // "owner=VALUES(owner), " + |
| | | // "civilCode=VALUES(civilCode), " + |
| | | // "block=VALUES(block), " + |
| | | // "subCount=VALUES(subCount), " + |
| | | // "address=VALUES(address), " + |
| | | // "parental=VALUES(parental), " + |
| | | // "parentId=VALUES(parentId), " + |
| | | // "safetyWay=VALUES(safetyWay), " + |
| | | // "registerWay=VALUES(registerWay), " + |
| | | // "certNum=VALUES(certNum), " + |
| | | // "certifiable=VALUES(certifiable), " + |
| | | // "errCode=VALUES(errCode), " + |
| | | // "secrecy=VALUES(secrecy), " + |
| | | // "ipAddress=VALUES(ipAddress), " + |
| | | // "port=VALUES(port), " + |
| | | // "password=VALUES(password), " + |
| | | // "PTZType=VALUES(PTZType), " + |
| | | // "status=VALUES(status), " + |
| | | // "streamId=VALUES(streamId), " + |
| | | // "longitude=VALUES(longitude), " + |
| | | // "latitude=VALUES(latitude), " + |
| | | // "longitudeGcj02=VALUES(longitudeGcj02), " + |
| | | // "latitudeGcj02=VALUES(latitudeGcj02), " + |
| | | // "longitudeWgs84=VALUES(longitudeWgs84), " + |
| | | // "latitudeWgs84=VALUES(latitudeWgs84), " + |
| | | // "hasAudio=VALUES(hasAudio), " + |
| | | // "businessGroupId=VALUES(businessGroupId), " + |
| | | // "gpsTime=VALUES(gpsTime)" + |
| | | // "</script>") |
| | | // int batchAdd(List<DeviceChannel> addChannels); |
| | | |
| | | |
| | | @Insert("<script> " + |
| | | "insert into device_channel " + |
| | | "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + |
| | | " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| | | " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + |
| | | " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + |
| | | "insert into wvp_device_channel " + |
| | | "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " + |
| | | " 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 " + |
| | | "<foreach collection='addChannels' index='index' item='item' separator=','> " + |
| | | "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + |
| | |
| | | |
| | | |
| | | @Insert("<script> " + |
| | | "insert into device_channel " + |
| | | "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + |
| | | " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| | | " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + |
| | | " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + |
| | | "insert into wvp_device_channel " + |
| | | "(channel_id,device_id,name,manufacture,model,owner,civil_code,block,sub_count,"+ |
| | | " 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 " + |
| | | "<foreach collection='addChannels' index='index' item='item' separator=','> " + |
| | | "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + |
| | |
| | | "#{item.businessGroupId}, #{item.gpsTime}) " + |
| | | "</foreach> " + |
| | | "ON DUPLICATE KEY UPDATE " + |
| | | "updateTime=VALUES(updateTime), " + |
| | | "update_time=VALUES(update_time), " + |
| | | "name=VALUES(name), " + |
| | | "manufacture=VALUES(manufacture), " + |
| | | "model=VALUES(model), " + |
| | | "owner=VALUES(owner), " + |
| | | "civilCode=VALUES(civilCode), " + |
| | | "civil_code=VALUES(civil_code), " + |
| | | "block=VALUES(block), " + |
| | | "subCount=VALUES(subCount), " + |
| | | "sub_count=VALUES(sub_count), " + |
| | | "address=VALUES(address), " + |
| | | "parental=VALUES(parental), " + |
| | | "parentId=VALUES(parentId), " + |
| | | "safetyWay=VALUES(safetyWay), " + |
| | | "registerWay=VALUES(registerWay), " + |
| | | "certNum=VALUES(certNum), " + |
| | | "parent_id=VALUES(parent_id), " + |
| | | "safety_way=VALUES(safety_way), " + |
| | | "register_way=VALUES(register_way), " + |
| | | "cert_num=VALUES(cert_num), " + |
| | | "certifiable=VALUES(certifiable), " + |
| | | "errCode=VALUES(errCode), " + |
| | | "err_code=VALUES(err_code), " + |
| | | "secrecy=VALUES(secrecy), " + |
| | | "ipAddress=VALUES(ipAddress), " + |
| | | "ip_address=VALUES(ip_address), " + |
| | | "port=VALUES(port), " + |
| | | "password=VALUES(password), " + |
| | | "PTZType=VALUES(PTZType), " + |
| | | "ptz_type=VALUES(ptz_type), " + |
| | | "status=VALUES(status), " + |
| | | "streamId=VALUES(streamId), " + |
| | | "stream_id=VALUES(stream_id), " + |
| | | "longitude=VALUES(longitude), " + |
| | | "latitude=VALUES(latitude), " + |
| | | "longitudeGcj02=VALUES(longitudeGcj02), " + |
| | | "latitudeGcj02=VALUES(latitudeGcj02), " + |
| | | "longitudeWgs84=VALUES(longitudeWgs84), " + |
| | | "latitudeWgs84=VALUES(latitudeWgs84), " + |
| | | "hasAudio=VALUES(hasAudio), " + |
| | | "businessGroupId=VALUES(businessGroupId), " + |
| | | "gpsTime=VALUES(gpsTime)" + |
| | | "longitude_gcj02=VALUES(longitude_gcj02), " + |
| | | "latitude_gcj02=VALUES(latitude_gcj02), " + |
| | | "longitude_wgs84=VALUES(longitude_wgs84), " + |
| | | "latitude_wgs84=VALUES(latitude_wgs84), " + |
| | | "has_audio=VALUES(has_audio), " + |
| | | "business_group_id=VALUES(business_group_id), " + |
| | | "gps_time=VALUES(gps_time)" + |
| | | "</script>") |
| | | int batchAddOrUpdate(List<DeviceChannel> 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({"<script>" + |
| | | "<foreach collection='updateChannels' item='item' separator=';'>" + |
| | | " UPDATE" + |
| | | " device_channel" + |
| | | " SET updateTime=#{item.updateTime}" + |
| | | " wvp_device_channel" + |
| | | " SET update_time=#{item.updateTime}" + |
| | | "<if test='item.name != null'>, name=#{item.name}</if>" + |
| | | "<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" + |
| | | "<if test='item.model != null'>, model=#{item.model}</if>" + |
| | | "<if test='item.owner != null'>, owner=#{item.owner}</if>" + |
| | | "<if test='item.civilCode != null'>, civilCode=#{item.civilCode}</if>" + |
| | | "<if test='item.civil_code != null'>, civil_code=#{item.civilCode}</if>" + |
| | | "<if test='item.block != null'>, block=#{item.block}</if>" + |
| | | "<if test='item.subCount != null'>, subCount=#{item.subCount}</if>" + |
| | | "<if test='item.subCount != null'>, sub_count=#{item.subCount}</if>" + |
| | | "<if test='item.address != null'>, address=#{item.address}</if>" + |
| | | "<if test='item.parental != null'>, parental=#{item.parental}</if>" + |
| | | "<if test='item.parentId != null'>, parentId=#{item.parentId}</if>" + |
| | | "<if test='item.safetyWay != null'>, safetyWay=#{item.safetyWay}</if>" + |
| | | "<if test='item.registerWay != null'>, registerWay=#{item.registerWay}</if>" + |
| | | "<if test='item.certNum != null'>, certNum=#{item.certNum}</if>" + |
| | | "<if test='item.parentId != null'>, parent_id=#{item.parentId}</if>" + |
| | | "<if test='item.safetyWay != null'>, safety_way=#{item.safetyWay}</if>" + |
| | | "<if test='item.registerWay != null'>, register_way=#{item.registerWay}</if>" + |
| | | "<if test='item.certNum != null'>, cert_num=#{item.certNum}</if>" + |
| | | "<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" + |
| | | "<if test='item.errCode != null'>, errCode=#{item.errCode}</if>" + |
| | | "<if test='item.errCode != null'>, err_code=#{item.errCode}</if>" + |
| | | "<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" + |
| | | "<if test='item.ipAddress != null'>, ipAddress=#{item.ipAddress}</if>" + |
| | | "<if test='item.ipAddress != null'>, ip_address=#{item.ipAddress}</if>" + |
| | | "<if test='item.port != null'>, port=#{item.port}</if>" + |
| | | "<if test='item.password != null'>, password=#{item.password}</if>" + |
| | | "<if test='item.PTZType != null'>, PTZType=#{item.PTZType}</if>" + |
| | | "<if test='item.PTZType != null'>, ptz_type=#{item.PTZType}</if>" + |
| | | "<if test='item.status != null'>, status=#{item.status}</if>" + |
| | | "<if test='item.streamId != null'>, streamId=#{item.streamId}</if>" + |
| | | "<if test='item.hasAudio != null'>, hasAudio=#{item.hasAudio}</if>" + |
| | | "<if test='item.streamId != null'>, stream_id=#{item.streamId}</if>" + |
| | | "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" + |
| | | "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + |
| | | "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + |
| | | "<if test='item.longitudeGcj02 != null'>, longitudeGcj02=#{item.longitudeGcj02}</if>" + |
| | | "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=#{item.latitudeGcj02}</if>" + |
| | | "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=#{item.longitudeWgs84}</if>" + |
| | | "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=#{item.latitudeWgs84}</if>" + |
| | | "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" + |
| | | "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" + |
| | | "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" + |
| | | "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" + |
| | | "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" + |
| | | "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + |
| | | "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" + |
| | | "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" + |
| | | "<if test='item.id > 0'>WHERE id=#{item.id}</if>" + |
| | | "<if test='item.id == 0'>WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}</if>" + |
| | | "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int batchUpdate(List<DeviceChannel> 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<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); |
| | | |
| | | @Delete(value = {" <script>" + |
| | | "DELETE " + |
| | | "from " + |
| | | "device_channel " + |
| | | "wvp_device_channel " + |
| | | "WHERE " + |
| | | "deviceId = #{deviceId} " + |
| | | " AND channelId NOT IN " + |
| | | "device_id = #{deviceId} " + |
| | | " AND channel_id NOT IN " + |
| | | "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" + |
| | | " </script>"}) |
| | | int cleanChannelsNotInList(String deviceId, List<DeviceChannel> 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 = {" <script>" + |
| | | "UPDATE device_channel " + |
| | | "UPDATE wvp_device_channel " + |
| | | "SET " + |
| | | "latitude=#{latitude}, " + |
| | | "longitude=#{longitude}, " + |
| | | "longitudeGcj02=#{longitudeGcj02}, " + |
| | | "latitudeGcj02=#{latitudeGcj02}, " + |
| | | "longitudeWgs84=#{longitudeWgs84}, " + |
| | | "latitudeWgs84=#{latitudeWgs84}, " + |
| | | "gpsTime=#{gpsTime} " + |
| | | "WHERE deviceId=#{deviceId} " + |
| | | " <if test='channelId != null' > AND channelId=#{channelId}</if>" + |
| | | "longitude_gcj02=#{longitudeGcj02}, " + |
| | | "latitude_gcj02=#{latitudeGcj02}, " + |
| | | "longitude_wgs84=#{longitudeWgs84}, " + |
| | | "latitude_wgs84=#{latitudeWgs84}, " + |
| | | "gps_time=#{gpsTime} " + |
| | | "WHERE device_id=#{deviceId} " + |
| | | " <if test='channelId != null' > AND channel_id=#{channelId}</if>" + |
| | | " </script>"}) |
| | | 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<DeviceChannel> 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<DeviceChannel> getAllChannelWithCoordinate(String deviceId); |
| | | |
| | | |
| | | @Select(value = {" <script>" + |
| | | "select * " + |
| | | "from device_channel " + |
| | | "where deviceId=#{deviceId}" + |
| | | " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} and length(channelId)=#{length} </if>" + |
| | | " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=#{length} </if>" + |
| | | " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" + |
| | | " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} </if>" + |
| | | "from wvp_device_channel " + |
| | | "where device_id=#{deviceId}" + |
| | | " <if test='parentId != null and length != null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} and length(channel_id)=#{length} </if>" + |
| | | " <if test='parentId == null and length != null' > and parent_id= #{parentId} or length(channel_id)=#{length} </if>" + |
| | | " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" + |
| | | " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" + |
| | | " </script>"}) |
| | | List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); |
| | | |
| | | @Select(value = {" <script>" + |
| | | "select * " + |
| | | "from device_channel " + |
| | | "where deviceId=#{deviceId} and length(channelId)>14 and civilCode=#{parentId}" + |
| | | "from wvp_device_channel " + |
| | | "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" + |
| | | " </script>"}) |
| | | List<DeviceChannel> 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<DeviceChannel> 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<DeviceChannel> 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<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); |
| | | |
| | | @Select("select dc.id, dc.channelId, dc.deviceId, dc.name, dc.manufacture,dc.model,dc.owner, pc.civilCode,dc.block, " + |
| | | " dc.address, '0' as parental,'0' as channelType, pc.id as parentId, dc.safetyWay, dc.registerWay,dc.certNum, dc.certifiable, " + |
| | | " dc.errCode,dc.endTime, dc.secrecy, dc.ipAddress, dc.port, dc.PTZType, dc.password, dc.status, " + |
| | | " dc.longitudeWgs84 as longitude, dc.latitudeWgs84 as latitude, pc.businessGroupId " + |
| | | " from device_channel dc" + |
| | | " left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" + |
| | | " left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" + |
| | | " where pgc.platformId=#{serverGBId}") |
| | | @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<DeviceChannel> queryChannelWithCatalog(String serverGBId); |
| | | |
| | | @Select("select * from device_channel where deviceId = #{deviceId}") |
| | | @Select("select * from wvp_device_channel where device_id = #{deviceId}") |
| | | List<DeviceChannel> 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} " + |
| | | ",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<DeviceChannel> 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<Device> getDeviceByChannelId(String channelId); |
| | | |
| | | |
| | | @Delete({"<script>" + |
| | | "<foreach collection='deleteChannelList' item='item' separator=';'>" + |
| | | "DELETE FROM device_channel WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + |
| | | "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int batchDel(List<DeviceChannel> deleteChannelList); |
| | | |
| | | @Update({"<script>" + |
| | | "<foreach collection='channels' item='item' separator=';'>" + |
| | | "UPDATE device_channel SET status=1 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + |
| | | "UPDATE wvp_device_channel SET status=1 WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int batchOnline(List<DeviceChannel> channels); |
| | | |
| | | @Update({"<script>" + |
| | | "<foreach collection='channels' item='item' separator=';'>" + |
| | | "UPDATE device_channel SET status=0 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + |
| | | "UPDATE wvp_device_channel SET status=0 WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int batchOffline(List<DeviceChannel> channels); |
| | |
| | | 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," + |
| | | "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}," + |
| | |
| | | int add(Device device); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE device " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "UPDATE wvp_device " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"name != null\">, name=#{name}</if>" + |
| | | "<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" + |
| | | "<if test=\"model != null\">, model=#{model}</if>" + |
| | | "<if test=\"firmware != null\">, firmware=#{firmware}</if>" + |
| | | "<if test=\"transport != null\">, transport=#{transport}</if>" + |
| | | "<if test=\"ip != null\">, ip=#{ip}</if>" + |
| | | "<if test=\"localIp != null\">, localIp=#{localIp}</if>" + |
| | | "<if test=\"localIp != null\">, local_ip=#{localIp}</if>" + |
| | | "<if test=\"port != null\">, port=#{port}</if>" + |
| | | "<if test=\"hostAddress != null\">, hostAddress=#{hostAddress}</if>" + |
| | | "<if test=\"hostAddress != null\">, host_address=#{hostAddress}</if>" + |
| | | "<if test=\"online != null\">, online=#{online}</if>" + |
| | | "<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" + |
| | | "<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" + |
| | | "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" + |
| | | "<if test=\"registerTime != null\">, register_time=#{registerTime}</if>" + |
| | | "<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" + |
| | | "<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" + |
| | | "<if test=\"expires != null\">, expires=#{expires}</if>" + |
| | | "WHERE deviceId=#{deviceId}"+ |
| | | "WHERE device_id=#{deviceId}"+ |
| | | " </script>"}) |
| | | int update(Device device); |
| | | |
| | | @Select( |
| | | " <script>" + |
| | | "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=de.deviceId) as channelCount FROM device de" + |
| | | "media_server_id,"+ |
| | | "(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count FROM wvp_device de" + |
| | | "<if test=\"online != null\"> where online=${online}</if>"+ |
| | | " </script>" |
| | | ) |
| | | List<Device> 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," + |
| | | "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 " + |
| | | " FROM device WHERE online = 1") |
| | | " FROM wvp_device WHERE online = true") |
| | | List<Device> getOnlineDevices(); |
| | | @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" + |
| | | " FROM device WHERE ip = #{host} AND port=#{port}") |
| | | " FROM wvp_device WHERE ip = #{host} AND port=#{port}") |
| | | Device getDeviceByHostAndPort(String host, int port); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE device " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "UPDATE wvp_device " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"name != null\">, custom_name=#{name}</if>" + |
| | | "<if test=\"password != null\">, password=#{password}</if>" + |
| | | "<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" + |
| | | "<if test=\"streamMode != null\">, stream_mode=#{streamMode}</if>" + |
| | | "<if test=\"ip != null\">, ip=#{ip}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" + |
| | | "<if test=\"port != null\">, port=#{port}</if>" + |
| | | "<if test=\"charset != null\">, charset=#{charset}</if>" + |
| | | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" + |
| | | "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=#{subscribeCycleForMobilePosition}</if>" + |
| | | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + |
| | | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + |
| | | "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + |
| | | "<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" + |
| | | "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + |
| | | "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + |
| | | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + |
| | | "WHERE deviceId=#{deviceId}"+ |
| | | "<if test=\"subscribeCycleForCatalog != null\">, subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}</if>" + |
| | | "<if test=\"subscribeCycleForMobilePosition != null\">, subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition}</if>" + |
| | | "<if test=\"mobilePositionSubmissionInterval != null\">, mobile_position_submission_interval=#{mobilePositionSubmissionInterval}</if>" + |
| | | "<if test=\"subscribeCycleForAlarm != null\">, subscribe_cycle_for_alarm=#{subscribeCycleForAlarm}</if>" + |
| | | "<if test=\"ssrcCheck != null\">, ssrc_check=#{ssrcCheck}</if>" + |
| | | "<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" + |
| | | "<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" + |
| | | "<if test=\"treeType != null\">, tree_type=#{treeType}</if>" + |
| | | "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" + |
| | | "WHERE device_id=#{deviceId}"+ |
| | | " </script>"}) |
| | | void updateCustom(Device device); |
| | | |
| | | @Insert("INSERT INTO device (" + |
| | | "deviceId, " + |
| | | @Insert("INSERT INTO wvp_device (" + |
| | | "device_id,"+ |
| | | "custom_name, " + |
| | | "password, " + |
| | | "sdpIp, " + |
| | | "createTime," + |
| | | "updateTime," + |
| | | "sdp_ip,"+ |
| | | "create_time,"+ |
| | | "update_time,"+ |
| | | "charset," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "ssrc_check,"+ |
| | | "as_message_channel,"+ |
| | | "geo_coord_sys,"+ |
| | | "tree_type,"+ |
| | | "online," + |
| | | "mediaServerId" + |
| | | "media_server_id"+ |
| | | ") VALUES (" + |
| | | "#{deviceId}," + |
| | | "#{name}," + |
| | |
| | | ")") |
| | | 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<Device> getAll(); |
| | | |
| | | @Select("select * from device where asMessageChannel = 1") |
| | | @Select("select * FROM wvp_device where as_message_channel = true") |
| | | List<Device> queryDeviceWithAsMessageChannel(); |
| | | } |
| | |
| | | @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 = {" <script>" + |
| | | "SELECT * FROM device_mobile_position" + |
| | | " WHERE deviceId = #{deviceId}" + |
| | | "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" + |
| | | "SELECT * FROM wvp_device_mobile_position" + |
| | | " WHERE device_id = #{deviceId}" + |
| | | "<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" + |
| | | "<if test=\"startTime != null\"> AND time>=#{startTime}</if>" + |
| | | "<if test=\"endTime != null\"> AND time<=#{endTime}</if>" + |
| | | " ORDER BY time ASC" + |
| | | " </script>"}) |
| | | List<MobilePosition> 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); |
| | | |
| | | } |
| | |
| | | @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("<script> "+ |
| | | "SELECT gs.* FROM gb_stream gs " + |
| | | "SELECT gs.* FROM wvp_gb_stream gs " + |
| | | "WHERE " + |
| | | "1=1 " + |
| | | " <if test='catalogId != null'> AND gs.gbStreamId in" + |
| | | "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " + |
| | | " <if test='catalogId == null'> AND gs.gbStreamId not in" + |
| | | "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " + |
| | | " <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" + |
| | | " order by gs.gbStreamId asc " + |
| | | " <if test='catalogId != null'> AND gs.gb_stream_id in" + |
| | | "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId} and pgs.catalog_id=#{catalogId})</if> " + |
| | | " <if test='catalogId == null'> AND gs.gb_stream_id not in" + |
| | | "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId}) </if> " + |
| | | " <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" + |
| | | " order by gs.gb_stream_id asc " + |
| | | "</script>") |
| | | List<GbStream> 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<GbStream> 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("<script> "+ |
| | | "select gt.gbId as channelId, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parentId," + |
| | | " '1' as registerWay, pc.civilCode, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" + |
| | | " from gb_stream gt " + |
| | | "select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parent_id," + |
| | | " '1' as register_way, pc.civil_code, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" + |
| | | " from wvp_gb_stream gt " + |
| | | " left join (" + |
| | | " select " + |
| | | " <if test='usPushingAsStatus != true'> sp.status as status, </if>" + |
| | | " <if test='usPushingAsStatus == true'> sp.pushIng as status, </if>" + |
| | | "sp.app, sp.stream from stream_push sp" + |
| | | " <if test='usPushingAsStatus == true'> sp.push_ing as status, </if>" + |
| | | "sp.app, sp.stream from wvp_stream_push sp" + |
| | | " union all" + |
| | | " select spxy.status, spxy.app, spxy.stream from stream_proxy spxy" + |
| | | " select spxy.status, spxy.app, spxy.stream from wvp_stream_proxy spxy" + |
| | | " ) st on st.app = gt.app and st.stream = gt.stream" + |
| | | " left join platform_gb_stream pgs on gt.gbStreamId = pgs.gbStreamId" + |
| | | " left join platform_catalog pc on pgs.catalogId = pc.id and pgs.platformId = pc.platformId" + |
| | | " where pgs.platformId=#{platformId}" + |
| | | " left join wvp_platform_gb_stream pgs on gt.gb_stream_id = pgs.gb_stream_id" + |
| | | " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" + |
| | | " where pgs.platform_id=#{platformId}" + |
| | | "</script>") |
| | | List<DeviceChannel> 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<GbStream> 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("<script> "+ |
| | | "DELETE FROM gb_stream where " + |
| | | "DELETE FROM wvp_gb_stream where " + |
| | | "<foreach collection='streamProxyItemList' item='item' separator='or'>" + |
| | | "(app=#{item.app} and stream=#{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | void batchDel(List<StreamProxyItem> streamProxyItemList); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM gb_stream where " + |
| | | "DELETE FROM wvp_gb_stream where " + |
| | | "<foreach collection='gbStreams' item='item' separator='or'>" + |
| | | "(app=#{item.app} and stream=#{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | void batchDelForGbStream(List<GbStream> gbStreams); |
| | | |
| | | @Insert("<script> " + |
| | | "INSERT IGNORE into gb_stream " + |
| | | "(app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, createTime)" + |
| | | "INSERT IGNORE into wvp_gb_stream " + |
| | | "(app, stream, gb_id, name, " + |
| | | "longitude, latitude, stream_type,media_server_id,create_time)" + |
| | | "values " + |
| | | "<foreach collection='subList' index='index' item='item' separator=','> " + |
| | | "(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " + |
| | |
| | | @Update({"<script>" + |
| | | "<foreach collection='gpsMsgInfos' item='item' separator=';'>" + |
| | | " UPDATE" + |
| | | " gb_stream" + |
| | | " wvp_gb_stream" + |
| | | " SET longitude=#{item.lng}, latitude=#{item.lat} " + |
| | | "WHERE gbId=#{item.id}"+ |
| | | "WHERE gb_id=#{item.id}"+ |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos); |
| | | |
| | | @Select("<script> "+ |
| | | "SELECT * FROM gb_stream where " + |
| | | "SELECT * FROM wvp_gb_stream where " + |
| | | "<foreach collection='streamPushItems' item='item' separator='or'>" + |
| | | "(app=#{item.app} and stream=#{item.stream}) " + |
| | | "</foreach>" + |
| | | "</script>") |
| | | List<GbStream> selectAllForAppAndStream(List<StreamPushItem> 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("<script> "+ |
| | | " <foreach collection='list' item='item' index='index' separator=';'>"+ |
| | | "UPDATE gb_stream " + |
| | | "UPDATE wvp_gb_stream " + |
| | | " SET name=#{item.name},"+ |
| | | " gbId=#{item.gbId}"+ |
| | | " gb_id=#{item.gb_id}"+ |
| | | " WHERE app=#{item.app} and stream=#{item.stream}"+ |
| | | "</foreach>"+ |
| | | "</script>") |
| | | int updateGbIdOrName(List<StreamPushItem> 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); |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | @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 = {"<script>" + |
| | | " SELECT * FROM log " + |
| | | " SELECT * FROM wvp_log " + |
| | | " WHERE 1=1 " + |
| | | " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test=\"type != null\" > AND type = #{type}</if>" + |
| | | " <if test=\"startTime != null\" > AND createTime >= #{startTime} </if>" + |
| | | " <if test=\"endTime != null\" > AND createTime <= #{endTime} </if>" + |
| | | " ORDER BY createTime DESC " + |
| | | " <if test=\"startTime != null\" > AND create_time >= #{startTime} </if>" + |
| | | " <if test=\"endTime != null\" > AND create_time <= #{endTime} </if>" + |
| | | " ORDER BY create_time DESC " + |
| | | " </script>"}) |
| | | List<LogDto> query(String query, String type, String startTime, String endTime); |
| | | |
| | | @Delete("DELETE FROM log") |
| | | @Delete("DELETE FROM wvp_log") |
| | | int clear(); |
| | | } |
| | |
| | | @Repository |
| | | public interface MediaServerMapper { |
| | | |
| | | @Insert("INSERT INTO media_server (" + |
| | | @Insert("INSERT INTO wvp_media_server (" + |
| | | "id, " + |
| | | "ip, " + |
| | | "hookIp, " + |
| | | "sdpIp, " + |
| | | "streamIp, " + |
| | | "httpPort, " + |
| | | "httpSSlPort, " + |
| | | "rtmpPort, " + |
| | | "rtmpSSlPort, " + |
| | | "rtpProxyPort, " + |
| | | "rtspPort, " + |
| | | "rtspSSLPort, " + |
| | | "autoConfig, " + |
| | | "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, " + |
| | | "rtpEnable, " + |
| | | "rtpPortRange, " + |
| | | "recordAssistPort, " + |
| | | "defaultServer, " + |
| | | "createTime, " + |
| | | "updateTime, " + |
| | | "hookAliveInterval" + |
| | | "rtp_enable,"+ |
| | | "rtp_port_range,"+ |
| | | "record_assist_port,"+ |
| | | "default_server,"+ |
| | | "create_time,"+ |
| | | "update_time,"+ |
| | | "hook_alive_interval"+ |
| | | ") VALUES " + |
| | | "(" + |
| | | "#{id}, " + |
| | |
| | | int add(MediaServerItem mediaServerItem); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE media_server " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "UPDATE wvp_media_server " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"ip != null\">, ip=#{ip}</if>" + |
| | | "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + |
| | | "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" + |
| | | "<if test=\"httpPort != null\">, httpPort=#{httpPort}</if>" + |
| | | "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" + |
| | | "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" + |
| | | "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" + |
| | | "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" + |
| | | "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" + |
| | | "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" + |
| | | "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" + |
| | | "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" + |
| | | "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + |
| | | "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" + |
| | | "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" + |
| | | "<if test=\"httpPort != null\">, http_port=#{httpPort}</if>" + |
| | | "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" + |
| | | "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" + |
| | | "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" + |
| | | "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" + |
| | | "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" + |
| | | "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" + |
| | | "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" + |
| | | "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" + |
| | | "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" + |
| | | "<if test=\"secret != null\">, secret=#{secret}</if>" + |
| | | "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" + |
| | | "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" + |
| | | "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" + |
| | | "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" + |
| | | "WHERE id=#{id}"+ |
| | | " </script>"}) |
| | | int update(MediaServerItem mediaServerItem); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE media_server " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "UPDATE wvp_media_server " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"id != null\">, id=#{id}</if>" + |
| | | "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + |
| | | "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" + |
| | | "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" + |
| | | "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" + |
| | | "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" + |
| | | "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" + |
| | | "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" + |
| | | "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" + |
| | | "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" + |
| | | "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" + |
| | | "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + |
| | | "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" + |
| | | "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" + |
| | | "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" + |
| | | "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" + |
| | | "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" + |
| | | "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" + |
| | | "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" + |
| | | "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" + |
| | | "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" + |
| | | "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" + |
| | | "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" + |
| | | "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" + |
| | | "<if test=\"secret != null\">, secret=#{secret}</if>" + |
| | | "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" + |
| | | "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" + |
| | | "WHERE ip=#{ip} and httpPort=#{httpPort}"+ |
| | | "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" + |
| | | "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" + |
| | | "WHERE ip=#{ip} and http_port=#{httpPort}"+ |
| | | " </script>"}) |
| | | 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<MediaServerItem> 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(); |
| | | } |
| | |
| | | @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<ParentPlatform> getParentPlatformList(); |
| | | |
| | | @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") |
| | | @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ") |
| | | List<ParentPlatform> 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<ParentPlatform> 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 = {" <script>" + |
| | | "UPDATE parent_platform " + |
| | | "SET catalogId=#{catalogId}, updateTime=#{updateTime}" + |
| | | "WHERE serverGBId=#{platformId}"+ |
| | | "UPDATE wvp_platform " + |
| | | "SET catalog_id=#{catalogId}, update_time=#{updateTime}" + |
| | | "WHERE server_gb_id=#{platformId}"+ |
| | | "</script>"}) |
| | | 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<ChannelSourceInfo> 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<ChannelSourceInfo> getChannelSource(String platform_id, String gbId); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | @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<PlatformCatalog> 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 = {" <script>" + |
| | |
| | | "</script>"}) |
| | | 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<PlatformCatalog> 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<DeviceChannel> queryCatalogInPlatform(String platformId); |
| | | } |
| | |
| | | * æ¥è¯¢å表éå·²ç»å
³èç |
| | | */ |
| | | @Select("<script> "+ |
| | | "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + |
| | | "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + |
| | | "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + |
| | | "</script>") |
| | | List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); |
| | | |
| | | @Insert("<script> "+ |
| | | "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" + |
| | | "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" + |
| | | "<foreach collection='channelReducesToAdd' item='item' separator=','>" + |
| | | " (#{platformId}, #{item.id} , #{item.catalogId} )" + |
| | | "</foreach>" + |
| | |
| | | int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + |
| | | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + |
| | | "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + |
| | | "</script>") |
| | | int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_channel WHERE deviceChannelId in " + |
| | | "( select temp.deviceChannelId from " + |
| | | "(select pgc.deviceChannelId from platform_gb_channel pgc " + |
| | | "left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " + |
| | | "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " + |
| | | "( select temp.device_channel_id from " + |
| | | "(select pgc.device_channel_id from wvp_platform_gb_channel pgc " + |
| | | "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " + |
| | | ") temp)" + |
| | | "</script>") |
| | | int delChannelForDeviceId(String deviceId); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" + |
| | | "</script>") |
| | | 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<DeviceChannel> 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<DeviceChannel> 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<PlatformCatalog> 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<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_channel WHERE catalogId=#{id}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" + |
| | | "</script>") |
| | | int delByCatalogId(String id); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" + |
| | | "</script>") |
| | | int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); |
| | | |
| | |
| | | "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" + |
| | | "dc.channel_id = #{channelId} and pp.status = true " + |
| | | "AND pp.server_gb_id IN" + |
| | | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| | | "</script> ") |
| | | List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); |
| | | |
| | | @Delete("<script> " + |
| | | "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" + |
| | | "</script>") |
| | | void delByPlatformId(String serverGBId); |
| | | |
| | | @Delete("<script> " + |
| | | "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" + |
| | | "</script>") |
| | | 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<Device> 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<String> queryParentPlatformByChannelId(String channelId); |
| | | } |
| | |
| | | @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("<script> " + |
| | | "INSERT into platform_gb_stream " + |
| | | "(gbStreamId, platformId, catalogId) " + |
| | | "INSERT into wvp_platform_gb_stream " + |
| | | "(gb_stream_id, platform_id, catalog_id) " + |
| | | "values " + |
| | | "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + |
| | | "(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" + |
| | | "(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" + |
| | | "</foreach> " + |
| | | "</script>") |
| | | int batchAdd(List<StreamPushItem> 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<ParentPlatform> 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<GbStream> 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<PlatformCatalog> 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("<script> " + |
| | | "SELECT " + |
| | | "pp.* " + |
| | | "FROM " + |
| | | "parent_platform pp " + |
| | | "left join platform_gb_stream pgs on " + |
| | | "pp.serverGBId = pgs.platformId " + |
| | | "left join gb_stream gs " + |
| | | "on gs.gbStreamId = pgs.gbStreamId " + |
| | | "wvp_platform pp " + |
| | | "left join wvp_platform_gb_stream pgs 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}" + |
| | | "AND pp.serverGBId IN" + |
| | | "AND pp.server_gb_id IN" + |
| | | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| | | "</script> ") |
| | | List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> 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("<script> "+ |
| | | "DELETE FROM platform_gb_stream where gbStreamId in " + |
| | | "DELETE from wvp_platform_gb_stream where gb_stream_id in " + |
| | | "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" + |
| | | "#{item.gbStreamId}" + |
| | | "</foreach>" + |
| | |
| | | void delByGbStreams(List<GbStream> gbStreams); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " + |
| | | "DELETE from wvp_platform_gb_stream where platform_id=#{platformId} and gb_stream_id in " + |
| | | "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" + |
| | | "#{item.gbStreamId} " + |
| | | "</foreach>" + |
| | | "</script>") |
| | | void delByAppAndStreamsByPlatformId(List<GbStream> 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | @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 = {" <script>" + |
| | | "UPDATE user_role " + |
| | | "SET updateTime=#{updateTime} " + |
| | | "UPDATE wvp_user_role " + |
| | | "SET update_time=#{updateTime} " + |
| | | "<if test=\"name != null\">, name=#{name}</if>" + |
| | | "<if test=\"authority != null\">, authority=#{authority}</if>" + |
| | | "WHERE id != 1 and id=#{id}" + |
| | | " </script>"}) |
| | | 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<Role> selectAll(); |
| | | } |
| | |
| | | @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}, " + |
| | |
| | | "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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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(); |
| | | } |
| | |
| | | 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} )") |
| | |
| | | |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE stream_push " + |
| | | "SET updateTime=#{updateTime}" + |
| | | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + |
| | | "<if test=\"totalReaderCount != null\">, totalReaderCount=#{totalReaderCount}</if>" + |
| | | "<if test=\"originType != null\">, originType=#{originType}</if>" + |
| | | "<if test=\"originTypeStr != null\">, originTypeStr=#{originTypeStr}</if>" + |
| | | "<if test=\"pushTime != null\">, pushTime=#{pushTime}</if>" + |
| | | "<if test=\"aliveSecond != null\">, aliveSecond=#{aliveSecond}</if>" + |
| | | "<if test=\"pushIng != null\">, pushIng=#{pushIng}</if>" + |
| | | "UPDATE wvp_stream_push " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" + |
| | | "<if test=\"totalReaderCount != null\">, total_reader_count=#{totalReaderCount}</if>" + |
| | | "<if test=\"originType != null\">, origin_type=#{originType}</if>" + |
| | | "<if test=\"originTypeStr != null\">, origin_type_str=#{originTypeStr}</if>" + |
| | | "<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" + |
| | | "<if test=\"aliveSecond != null\">, alive_second=#{aliveSecond}</if>" + |
| | | "<if test=\"pushIng != null\">, push_ing=#{pushIng}</if>" + |
| | | "<if test=\"self != null\">, self=#{self}</if>" + |
| | | "WHERE app=#{app} AND stream=#{stream}"+ |
| | | " </script>"}) |
| | | 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("<script> "+ |
| | | "DELETE sp FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " + |
| | | "DELETE sp FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " + |
| | | "<foreach collection='streamPushItems' item='item' separator='or'>" + |
| | | "(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gbId is null) " + |
| | | "(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gb_id is null) " + |
| | | "</foreach>" + |
| | | "</script>") |
| | | int delAllWithoutGBId(List<StreamPushItem> streamPushItems); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM stream_push where " + |
| | | "DELETE FROM wvp_stream_push where " + |
| | | "<foreach collection='streamPushItems' item='item' separator='or'>" + |
| | | "(app=#{item.app} and stream=#{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | int delAll(List<StreamPushItem> streamPushItems); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE FROM stream_push where " + |
| | | "DELETE FROM wvp_stream_push where " + |
| | | "<foreach collection='gbStreams' item='item' separator='or'>" + |
| | | "(app=#{item.app} and stream=#{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | "st.*, " + |
| | | "gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + |
| | | "gs.gb_id, gs.name, gs.longitude, gs.latitude, gs.gb_stream_id " + |
| | | "from " + |
| | | "stream_push st " + |
| | | "LEFT JOIN gb_stream gs " + |
| | | "wvp_stream_push st " + |
| | | "LEFT join wvp_gb_stream gs " + |
| | | "on st.app = gs.app AND st.stream = gs.stream " + |
| | | "WHERE " + |
| | | "1=1 " + |
| | | " <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" + |
| | | " <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" + |
| | | " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + |
| | | "order by st.createTime desc" + |
| | | " <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + |
| | | " <if test='pushing == true' > AND (gs.gb_id is null OR st.push_ing=1)</if>" + |
| | | " <if test='pushing == false' > AND (st.push_ing is null OR st.push_ing=0) </if>" + |
| | | " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" + |
| | | "order by st.create_time desc" + |
| | | " </script>"}) |
| | | List<StreamPushItem> 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<StreamPushItem> 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("<script>" + |
| | | "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| | | "createTime, aliveSecond, mediaServerId, status, pushIng) " + |
| | | "Insert IGNORE INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + |
| | | "create_time, alive_second, media_server_id, status, push_ing) " + |
| | | "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + |
| | | "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " + |
| | | "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," + |
| | |
| | | @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") |
| | | int addAll(List<StreamPushItem> streamPushItems); |
| | | |
| | | @Delete("DELETE FROM stream_push") |
| | | @Delete("DELETE FROM wvp_stream_push") |
| | | void clear(); |
| | | |
| | | @Delete("DELETE sp FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null ") |
| | | @Delete("DELETE sp FROM wvp_stream_push sp left join wvp_gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.media_server_id=#{mediaServerId} and gs.gb_id is null ") |
| | | void deleteWithoutGBId(String mediaServerId); |
| | | |
| | | @Select("SELECT * FROM stream_push WHERE mediaServerId=#{mediaServerId}") |
| | | @Select("SELECT * FROM wvp_stream_push WHERE media_server_id=#{mediaServerId}") |
| | | List<StreamPushItem> selectAllByMediaServerId(String mediaServerId); |
| | | |
| | | @Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null") |
| | | @Select("SELECT sp.* FROM wvp_stream_push sp left join wvp_gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.media_server_id=#{mediaServerId} and gs.gb_id is null") |
| | | List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | @Update("UPDATE wvp_stream_push " + |
| | | "SET status=#{status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET pushIng=#{pushIng} " + |
| | | @Update("UPDATE wvp_stream_push " + |
| | | "SET push_ing=#{pushIng} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updatePushStatus(String app, String stream, boolean pushIng); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | @Update("UPDATE wvp_stream_push " + |
| | | "SET status=#{status} " + |
| | | "WHERE mediaServerId=#{mediaServerId}") |
| | | "WHERE media_server_id=#{mediaServerId}") |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | |
| | | @Select("<script> "+ |
| | | "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 and (gs.app, gs.stream) in (" + |
| | | "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 and (gs.app, gs.stream) in (" + |
| | | "<foreach collection='offlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams); |
| | | |
| | | @Update("<script> "+ |
| | | "UPDATE stream_push SET status=0 where (app, stream) in (" + |
| | | "UPDATE wvp_stream_push SET status=0 where (app, stream) in (" + |
| | | "<foreach collection='offlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | |
| | | void offline(List<StreamPushItemFromRedis> offlineStreams); |
| | | |
| | | @Select("<script> "+ |
| | | "SELECT * FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + |
| | | "SELECT * FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + |
| | | "where sp.status = 0 and (gs.app, gs.stream) in (" + |
| | | "<foreach collection='onlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | |
| | | List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams); |
| | | |
| | | @Update("<script> "+ |
| | | "UPDATE stream_push SET status=1 where (app, stream) in (" + |
| | | "UPDATE wvp_stream_push SET status=1 where (app, stream) in (" + |
| | | "<foreach collection='onlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | | ")</script>") |
| | | void online(List<StreamPushItemFromRedis> 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<GbStream> 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<String> getAllAppAndStream(); |
| | | |
| | | @Select(value = {" <script>" + |
| | | " <if test='pushIngAsOnline == true'> select count(1) as total, sum(pushIng) as online from stream_push </if>" + |
| | | " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from stream_push </if>" + |
| | | " <if test='pushIngAsOnline == true'> select count(1) as total, sum(push_ing) as online from wvp_stream_push </if>" + |
| | | " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from wvp_stream_push </if>" + |
| | | " </script>"}) |
| | | ResourceBaceInfo getOverview(boolean pushIngAsOnline); |
| | | } |
| | |
| | | @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 = {" <script>" + |
| | | "UPDATE user " + |
| | | "SET updateTime=#{updateTime} " + |
| | | "<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" + |
| | | "<if test=\"role != null\">, roleId=#{role.id}</if>" + |
| | | "UPDATE wvp_user " + |
| | | "SET update_time=#{updateTime} " + |
| | | "<if test=\"pushKey != null\">, push_key=#{pushKey}</if>" + |
| | | "<if test=\"role != null\">, role_id=#{role.id}</if>" + |
| | | "<if test=\"password != null\">, password=#{password}</if>" + |
| | | "<if test=\"username != null\">, username=#{username}</if>" + |
| | | "WHERE id=#{id}" + |
| | | " </script>"}) |
| | | 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<User> 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<User> checkPushAuthorityByCallIdAndSign(String callId, String sign); |
| | | |
| | | @Select("select * from user where md5(pushKey) = #{sign}") |
| | | @Select("select * from wvp_user where md5(push_key) = #{sign}") |
| | | List<User> 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<User> 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); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public boolean deviceIsOnline(String deviceId) { |
| | | return getDevice(deviceId).getOnline() == 1; |
| | | return getDevice(deviceId).isOnline(); |
| | | } |
| | | |
| | | |
| | |
| | | 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()); |
| | |
| | | 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); |