Commit d849352441eaf2ef3398eb25cd0f933ff59beec9

Authored by 648540858
1 parent ccecda78

重构以适配postgresql

Showing 34 changed files with 1265 additions and 844 deletions
@@ -135,6 +135,15 @@ @@ -135,6 +135,15 @@
135 <version>8.0.30</version> 135 <version>8.0.30</version>
136 </dependency> 136 </dependency>
137 137
  138 + <!--postgresql-->
  139 + <dependency>
  140 + <groupId>org.postgresql</groupId>
  141 + <artifactId>postgresql</artifactId>
  142 + <version>42.5.1</version>
  143 + </dependency>
  144 +
  145 +
  146 +
138 <!--Mybatis分页插件 --> 147 <!--Mybatis分页插件 -->
139 <dependency> 148 <dependency>
140 <groupId>com.github.pagehelper</groupId> 149 <groupId>com.github.pagehelper</groupId>
sql/2.6.8升级2.6.9.sql 0 → 100644
  1 +alter table device
  2 + change deviceId device_id varchar(50) not null;
  3 +
  4 +alter table device
  5 + change streamMode stream_mode varchar(50) null;
  6 +
  7 +alter table device
  8 + change registerTime register_time varchar(50) null;
  9 +
  10 +alter table device
  11 + change keepaliveTime keepalive_time varchar(50) null;
  12 +
  13 +alter table device
  14 + change createTime create_time varchar(50) not null;
  15 +
  16 +alter table device
  17 + change updateTime update_time varchar(50) not null;
  18 +
  19 +alter table device
  20 + change subscribeCycleForCatalog subscribe_cycle_for_catalog bool default false;
  21 +
  22 +alter table device
  23 + change subscribeCycleForMobilePosition subscribe_cycle_for_mobile_position bool default false;
  24 +
  25 +alter table device
  26 + change mobilePositionSubmissionInterval mobile_position_submission_interval int default 5 not null;
  27 +
  28 +alter table device
  29 + change subscribeCycleForAlarm subscribe_cycle_for_alarm bool default false;
  30 +
  31 +alter table device
  32 + change hostAddress host_address varchar(50) null;
  33 +
  34 +alter table device
  35 + change ssrcCheck ssrc_check bool default false;
  36 +
  37 +alter table device
  38 + change geoCoordSys geo_coord_sys varchar(50) not null;
  39 +
  40 +alter table device
  41 + change treeType tree_type varchar(50) not null;
  42 +
  43 +alter table device
  44 + change mediaServerId media_server_id varchar(50) default 'auto' null;
  45 +
  46 +alter table device
  47 + change sdpIp sdp_ip varchar(50) null;
  48 +
  49 +alter table device
  50 + change localIp local_ip varchar(50) null;
  51 +
  52 +alter table device
  53 + change asMessageChannel as_message_channel bool default false;
  54 +
  55 +alter table device
  56 + change keepaliveIntervalTime keepalive_interval_time int null;
  57 +
  58 +alter table device_alarm
  59 + change deviceId device_id varchar(50) not null;
  60 +
  61 +alter table device_alarm
  62 + change channelId channel_id varchar(50) not null;
  63 +
  64 +alter table device_alarm
  65 + change alarmPriority alarm_priority varchar(50) not null;
  66 +
  67 +alter table device_alarm
  68 + change alarmMethod alarm_method varchar(50) null;
  69 +
  70 +alter table device_alarm
  71 + change alarmTime alarm_time varchar(50) not null;
  72 +
  73 +alter table device_alarm
  74 + change alarmDescription alarm_description varchar(255) null;
  75 +
  76 +alter table device_alarm
  77 + change alarmType alarm_type varchar(50) null;
  78 +
  79 +alter table device_alarm
  80 + change createTime create_time varchar(50) null;
  81 +
  82 +alter table device_channel
  83 + change channelId channel_id varchar(50) not null;
  84 +
  85 +alter table device_channel
  86 + change civilCode civil_code varchar(50) null;
  87 +
  88 +alter table device_channel
  89 + change parentId parent_id varchar(50) null;
  90 +
  91 +alter table device_channel
  92 + change safetyWay safety_way int null;
  93 +
  94 +alter table device_channel
  95 + change registerWay register_way int null;
  96 +
  97 +alter table device_channel
  98 + change certNum cert_num varchar(50) null;
  99 +
  100 +alter table device_channel
  101 + change errCode err_code int null;
  102 +
  103 +alter table device_channel
  104 + change endTime end_time varchar(50) null;
  105 +
  106 +alter table device_channel
  107 + change ipAddress ip_address varchar(50) null;
  108 +
  109 +alter table device_channel
  110 + change PTZType ptz_type int null;
  111 +
  112 +alter table device_channel
  113 + change status status bool default false;
  114 +
  115 +alter table device_channel
  116 + change streamId stream_id varchar(50) null;
  117 +
  118 +alter table device_channel
  119 + change deviceId device_id varchar(50) not null;
  120 +
  121 +
  122 +alter table device_channel
  123 + change hasAudio has_audio bool default false;
  124 +
  125 +alter table device_channel
  126 + change createTime create_time varchar(50) not null;
  127 +
  128 +alter table device_channel
  129 + change updateTime update_time varchar(50) not null;
  130 +
  131 +alter table device_channel
  132 + change subCount sub_count int default 0 null;
  133 +
  134 +alter table device_channel
  135 + change longitudeGcj02 longitude_gcj02 double null;
  136 +
  137 +alter table device_channel
  138 + change latitudeGcj02 latitude_gcj02 double null;
  139 +
  140 +alter table device_channel
  141 + change longitudeWgs84 longitude_wgs84 double null;
  142 +
  143 +alter table device_channel
  144 + change latitudeWgs84 latitude_wgs84 double null;
  145 +
  146 +alter table device_channel
  147 + change businessGroupId business_group_id varchar(50) null;
  148 +
  149 +alter table device_channel
  150 + change gpsTime gps_time varchar(50) null;
  151 +
  152 +alter table device_mobile_position
  153 + change deviceId device_id varchar(50) not null;
  154 +
  155 +alter table device_mobile_position
  156 + change channelId channel_id varchar(50) not null;
  157 +
  158 +alter table device_mobile_position
  159 + change deviceName device_name varchar(255) null;
  160 +
  161 +alter table device_mobile_position
  162 + change reportSource report_source varchar(50) null;
  163 +
  164 +alter table device_mobile_position
  165 + change longitudeGcj02 longitude_gcj02 double null;
  166 +
  167 +alter table device_mobile_position
  168 + change latitudeGcj02 latitude_gcj02 double null;
  169 +
  170 +alter table device_mobile_position
  171 + change longitudeWgs84 longitude_wgs84 double null;
  172 +
  173 +alter table device_mobile_position
  174 + change latitudeWgs84 latitude_wgs84 double null;
  175 +
  176 +alter table device_mobile_position
  177 + change createTime create_time varchar(50) null;
  178 +
  179 +alter table gb_stream
  180 + add constraint gb_stream_pk
  181 + primary key (gbStreamId);
  182 +
  183 +alter table gb_stream
  184 + change gbStreamId gb_stream_id int auto_increment;
  185 +
  186 +alter table gb_stream
  187 + change gbId gb_id varchar(50) not null;
  188 +
  189 +alter table gb_stream
  190 + change streamType stream_type varchar(50) null;
  191 +
  192 +alter table gb_stream
  193 + change mediaServerId media_server_id varchar(50) null;
  194 +
  195 +alter table gb_stream
  196 + change createTime create_time varchar(50) null;
  197 +
  198 +alter table log
  199 + change createTime create_time varchar(50) not null;
  200 +
  201 +alter table media_server
  202 + change hookIp hook_ip varchar(50) not null;
  203 +
  204 +alter table media_server
  205 + change sdpIp sdp_ip varchar(50) not null;
  206 +
  207 +alter table media_server
  208 + change streamIp stream_ip varchar(50) not null;
  209 +
  210 +alter table media_server
  211 + change httpPort http_port int not null;
  212 +
  213 +alter table media_server
  214 + change httpSSlPort http_ssl_port int not null;
  215 +
  216 +alter table media_server
  217 + change rtmpPort rtmp_port int not null;
  218 +
  219 +alter table media_server
  220 + change rtmpSSlPort rtmp_ssl_port int not null;
  221 +
  222 +alter table media_server
  223 + change rtpProxyPort rtp_proxy_port int not null;
  224 +
  225 +alter table media_server
  226 + change rtspPort rtsp_port int not null;
  227 +
  228 +alter table media_server
  229 + change rtspSSLPort rtsp_ssl_port int not null;
  230 +
  231 +alter table media_server
  232 + change autoConfig auto_config bool default true;
  233 +
  234 +alter table media_server
  235 + change rtpEnable rtp_enable bool default false;
  236 +
  237 +alter table media_server
  238 + change rtpPortRange rtp_port_range varchar(50) not null;
  239 +
  240 +alter table media_server
  241 + change recordAssistPort record_assist_port int not null;
  242 +
  243 +alter table media_server
  244 + change defaultServer default_server bool default false;
  245 +
  246 +alter table media_server
  247 + change createTime create_time varchar(50) not null;
  248 +
  249 +alter table media_server
  250 + change updateTime update_time varchar(50) not null;
  251 +
  252 +alter table media_server
  253 + change hookAliveInterval hook_alive_interval int not null;
  254 +
  255 +alter table parent_platform
  256 + change serverGBId server_gb_id varchar(50) not null;
  257 +
  258 +alter table parent_platform
  259 + change serverGBDomain server_gb_domain varchar(50) null;
  260 +
  261 +alter table parent_platform
  262 + change serverIP server_ip varchar(50) null;
  263 +
  264 +alter table parent_platform
  265 + change serverPort server_port int null;
  266 +
  267 +alter table parent_platform
  268 + change deviceGBId device_gb_id varchar(50) not null;
  269 +
  270 +alter table parent_platform
  271 + change deviceIp device_ip varchar(50) null;
  272 +
  273 +alter table parent_platform
  274 + change devicePort device_port varchar(50) null;
  275 +
  276 +alter table parent_platform
  277 + change keepTimeout keep_timeout varchar(50) null;
  278 +
  279 +alter table parent_platform
  280 + change characterSet character_set varchar(50) null;
  281 +
  282 +alter table parent_platform
  283 + change catalogId catalog_id varchar(50) not null;
  284 +
  285 +alter table parent_platform
  286 + change startOfflinePush start_offline_push bool default false;
  287 +
  288 +alter table parent_platform
  289 + change administrativeDivision administrative_division varchar(50) not null;
  290 +
  291 +alter table parent_platform
  292 + change catalogGroup catalog_group int default 1 null;
  293 +
  294 +alter table parent_platform
  295 + change createTime create_time varchar(50) null;
  296 +
  297 +alter table parent_platform
  298 + change updateTime update_time varchar(50) null;
  299 +
  300 +alter table parent_platform
  301 + change treeType tree_type varchar(50) not null;
  302 +
  303 +alter table parent_platform
  304 + change asMessageChannel as_message_channel bool default false;
  305 +
  306 +alter table parent_platform
  307 + change enable enable bool default false;
  308 +
  309 +alter table parent_platform
  310 + change ptz ptz bool default false;
  311 +
  312 +alter table parent_platform
  313 + change rtcp rtcp bool default false;
  314 +
  315 +alter table parent_platform
  316 + change status status bool default false;
  317 +
  318 +alter table parent_platform
  319 + change status status bool default false;
  320 +
  321 +alter table platform_catalog
  322 + change platformId platform_id varchar(50) not null;
  323 +
  324 +alter table platform_catalog
  325 + change parentId parent_id varchar(50) null;
  326 +
  327 +alter table platform_catalog
  328 + change civilCode civil_code varchar(50) null;
  329 +
  330 +alter table platform_catalog
  331 + change businessGroupId business_group_id varchar(50) null;
  332 +
  333 +alter table platform_gb_channel
  334 + change platformId platform_id varchar(50) not null;
  335 +
  336 +alter table platform_gb_channel
  337 + change catalogId catalog_id varchar(50) not null;
  338 +
  339 +alter table platform_gb_channel
  340 + change deviceChannelId device_channel_id int not null;
  341 +
  342 +alter table platform_gb_stream
  343 + change platformId platform_id varchar(50) not null;
  344 +
  345 +alter table platform_gb_stream
  346 + change catalogId catalog_id varchar(50) not null;
  347 +
  348 +alter table platform_gb_stream
  349 + change gbStreamId gb_stream_id int not null;
  350 +
  351 +alter table stream_proxy
  352 + change mediaServerId media_server_id varchar(50) null;
  353 +
  354 +alter table stream_proxy
  355 + change createTime create_time varchar(50) not null;
  356 +
  357 +alter table stream_proxy
  358 + change updateTime update_time varchar(50) null;
  359 +
  360 +alter table stream_proxy
  361 + change enable_remove_none_reader enable_remove_none_reader bool default false;
  362 +
  363 +alter table stream_proxy
  364 + change enable_disable_none_reader enable_disable_none_reader bool default false;
  365 +
  366 +alter table stream_proxy
  367 + change enable_audio enable_audio bool default false;
  368 +
  369 +alter table stream_proxy
  370 + change enable_mp4 enable_mp4 bool default false;
  371 +
  372 +alter table stream_proxy
  373 + change enable enable bool default false;
  374 +
  375 +alter table stream_push
  376 + change totalReaderCount total_reader_count varchar(50) null;
  377 +
  378 +alter table stream_push
  379 + change originType origin_type int null;
  380 +
  381 +alter table stream_push
  382 + change originTypeStr origin_type_str varchar(50) null;
  383 +
  384 +alter table stream_push
  385 + change createTime create_time varchar(50) null;
  386 +
  387 +alter table stream_push
  388 + change aliveSecond alive_second int null;
  389 +
  390 +alter table stream_push
  391 + change mediaServerId media_server_id varchar(50) null;
  392 +
  393 +alter table stream_push
  394 + change status status bool default false;
  395 +
  396 +
  397 +alter table stream_push
  398 + change serverId server_id varchar(50) not null;
  399 +
  400 +alter table stream_push
  401 + change pushTime push_time varchar(50) null;
  402 +
  403 +alter table stream_push
  404 + change updateTime update_time varchar(50) null;
  405 +
  406 +alter table stream_push
  407 + change pushIng push_ing bool default false;
  408 +
  409 +alter table stream_push
  410 + change status status bool default false;
  411 +
  412 +alter table stream_push
  413 + change self self bool default false;
  414 +
  415 +alter table user
  416 + change roleId role_id int not null;
  417 +
  418 +alter table user
  419 + change createTime create_time varchar(50) not null;
  420 +
  421 +alter table user
  422 + change updateTime update_time varchar(50) not null;
  423 +
  424 +alter table user
  425 + change pushKey push_key varchar(50) null;
  426 +
  427 +alter table user_role
  428 + change createTime create_time varchar(50) not null;
  429 +
  430 +alter table user_role
  431 + change updateTime update_time varchar(50) not null;
  432 +
  433 +rename table device to wvp_device;
  434 +rename table device_alarm to wvp_device_alarm;
  435 +rename table device_channel to wvp_device_channel;
  436 +rename table device_mobile_position to wvp_device_mobile_position;
  437 +rename table gb_stream to wvp_gb_stream;
  438 +rename table log to wvp_log;
  439 +rename table media_server to wvp_media_server;
  440 +rename table parent_platform to wvp_platform;
  441 +rename table platform_catalog to wvp_platform_catalog;
  442 +rename table platform_gb_channel to wvp_platform_gb_channel;
  443 +rename table platform_gb_stream to wvp_platform_gb_stream;
  444 +rename table stream_proxy to wvp_stream_proxy;
  445 +rename table stream_push to wvp_stream_push;
  446 +rename table user to wvp_user;
  447 +rename table user_role to wvp_user_role;
  448 +
  449 +
  450 +
  451 +
  452 +
  453 +
  454 +
  455 +
  456 +
  457 +
  458 +
  459 +
  460 +
  461 +
  462 +
  463 +
  464 +
  465 +
  466 +
  467 +
  468 +
  469 +
  470 +
  471 +
  472 +
  473 +
  474 +
  475 +
  476 +
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
@@ -77,8 +77,8 @@ public class Device { @@ -77,8 +77,8 @@ public class Device {
77 /** 77 /**
78 * 在线 78 * 在线
79 */ 79 */
80 - @Schema(description = "是否在线,1为在线,0为离线")  
81 - private int online; 80 + @Schema(description = "是否在线,true为在线,false为离线")
  81 + private boolean online;
82 82
83 83
84 /** 84 /**
@@ -140,7 +140,7 @@ public class Device { @@ -140,7 +140,7 @@ public class Device {
140 /** 140 /**
141 * 目录订阅周期,0为不订阅 141 * 目录订阅周期,0为不订阅
142 */ 142 */
143 - @Schema(description = "目录订阅周期,0为不订阅") 143 + @Schema(description = "目录订阅周期,o为不订阅")
144 private int subscribeCycleForCatalog; 144 private int subscribeCycleForCatalog;
145 145
146 /** 146 /**
@@ -286,11 +286,11 @@ public class Device { @@ -286,11 +286,11 @@ public class Device {
286 this.hostAddress = hostAddress; 286 this.hostAddress = hostAddress;
287 } 287 }
288 288
289 - public int getOnline() { 289 + public boolean isOnline() {
290 return online; 290 return online;
291 } 291 }
292 292
293 - public void setOnline(int online) { 293 + public void setOnline(boolean online) {
294 this.online = online; 294 this.online = online;
295 } 295 }
296 296
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
@@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
10 public class GbStream extends PlatformGbStream{ 10 public class GbStream extends PlatformGbStream{
11 11
12 @Schema(description = "ID") 12 @Schema(description = "ID")
13 - private Integer gbStreamId; 13 + private int gbStreamId;
14 @Schema(description = "应用名") 14 @Schema(description = "应用名")
15 private String app; 15 private String app;
16 @Schema(description = "流ID") 16 @Schema(description = "流ID")
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java
@@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
5 public class PlatformGbStream { 5 public class PlatformGbStream {
6 6
7 @Schema(description = "ID") 7 @Schema(description = "ID")
8 - private Integer gbStreamId; 8 + private int gbStreamId;
9 9
10 @Schema(description = "平台ID") 10 @Schema(description = "平台ID")
11 private String platformId; 11 private String platformId;
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java
@@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent @@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
65 String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); 65 String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
66 66
67 Device device = redisCatchStorage.getDevice(deviceId); 67 Device device = redisCatchStorage.getDevice(deviceId);
68 - if (device == null || device.getOnline() == 0) { 68 + if (device == null || !device.isOnline()) {
69 logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); 69 logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
70 return; 70 return;
71 } 71 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
372 String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); 372 String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
373 373
374 Device device = redisCatchStorage.getDevice(deviceId); 374 Device device = redisCatchStorage.getDevice(deviceId);
375 - if (device == null || device.getOnline() == 0) { 375 + if (device == null || !device.isOnline()) {
376 logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); 376 logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
377 return; 377 return;
378 } 378 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
@@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen @@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
166 device.setGeoCoordSys("WGS84"); 166 device.setGeoCoordSys("WGS84");
167 device.setTreeType("CivilCode"); 167 device.setTreeType("CivilCode");
168 device.setDeviceId(deviceId); 168 device.setDeviceId(deviceId);
169 - device.setOnline(0); 169 + device.setOnline(false);
170 } 170 }
171 device.setIp(remoteAddressInfo.getIp()); 171 device.setIp(remoteAddressInfo.getIp());
172 device.setPort(remoteAddressInfo.getPort()); 172 device.setPort(remoteAddressInfo.getPort());
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
@@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp @@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
83 83
84 device.setKeepaliveTime(DateUtil.getNow()); 84 device.setKeepaliveTime(DateUtil.getNow());
85 85
86 - if (device.getOnline() == 1) { 86 + if (device.isOnline()) {
87 deviceService.updateDevice(device); 87 deviceService.updateDevice(device);
88 }else { 88 }else {
89 // 对于已经离线的设备判断他的注册是否已经过期 89 // 对于已经离线的设备判断他的注册是否已经过期
90 if (!deviceService.expire(device)){ 90 if (!deviceService.expire(device)){
91 - device.setOnline(0); 91 + device.setOnline(false);
92 deviceService.online(device, null); 92 deviceService.online(device, null);
93 } 93 }
94 } 94 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java
1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2
3 -import com.genersoft.iot.vmp.common.VideoManagerConstants;  
4 -import com.genersoft.iot.vmp.conf.SipConfig;  
5 import com.genersoft.iot.vmp.gb28181.bean.Device; 3 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
7 -import com.genersoft.iot.vmp.gb28181.event.EventPublisher;  
8 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; 5 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
9 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; 6 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
10 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
11 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; 8 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
12 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; 9 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
13 import com.genersoft.iot.vmp.service.IDeviceService; 10 import com.genersoft.iot.vmp.service.IDeviceService;
14 -import com.genersoft.iot.vmp.storager.IRedisCatchStorage;  
15 -import com.genersoft.iot.vmp.storager.IVideoManagerStorage;  
16 import gov.nist.javax.sip.message.SIPRequest; 11 import gov.nist.javax.sip.message.SIPRequest;
17 import org.dom4j.DocumentException; 12 import org.dom4j.DocumentException;
18 import org.dom4j.Element; 13 import org.dom4j.Element;
@@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent @@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent
59 public void handForDevice(RequestEvent evt, Device device, Element rootElement) { 54 public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
60 logger.debug("接收到DeviceInfo应答消息"); 55 logger.debug("接收到DeviceInfo应答消息");
61 // 检查设备是否存在, 不存在则不回复 56 // 检查设备是否存在, 不存在则不回复
62 - if (device == null || device.getOnline() == 0) { 57 + if (device == null || !device.isOnline()) {
63 logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]:" + (device != null ? device.getDeviceId():"" )); 58 logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]:" + (device != null ? device.getDeviceId():"" ));
64 return; 59 return;
65 } 60 }
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
@@ -325,5 +325,65 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte @@ -325,5 +325,65 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
325 public void setSelf(boolean self) { 325 public void setSelf(boolean self) {
326 this.self = self; 326 this.self = self;
327 } 327 }
  328 +
  329 +// @Override
  330 +// public Integer getGbStreamId() {
  331 +// return super.getGbStreamId();
  332 +// }
  333 +//
  334 +// @Override
  335 +// public void setGbStreamId(Integer gbStreamId) {
  336 +// super.setGbStreamId(gbStreamId);
  337 +// }
  338 +//
  339 +//
  340 +// public String getGbId() {
  341 +// return super.getGbId();
  342 +// }
  343 +//
  344 +// public void setGbId(String gbId) {
  345 +// super.setGbId(gbId);
  346 +// }
  347 +//
  348 +// public String getName() {
  349 +// return super.getName();
  350 +// }
  351 +//
  352 +// public void setName(String name) {
  353 +// super.setName(name);
  354 +// }
  355 +//
  356 +// public double getLongitude() {
  357 +// return super.getLongitude();
  358 +// }
  359 +//
  360 +// public void setLongitude(double longitude) {
  361 +// super.setLongitude(longitude);
  362 +// }
  363 +//
  364 +// public double getLatitude() {
  365 +// return super.getLatitude();
  366 +// }
  367 +//
  368 +// public void setLatitude(double latitude) {
  369 +// super.setLatitude(latitude);
  370 +// }
  371 +//
  372 +// public String getStreamType() {
  373 +// return super.getStreamType();
  374 +// }
  375 +//
  376 +// public void setStreamType(String streamType) {
  377 +// super.setStreamType(streamType);
  378 +// }
  379 +//
  380 +// public boolean isStatus() {
  381 +// return super.isStatus();
  382 +// }
  383 +//
  384 +// public void setStatus(boolean status) {
  385 +// super.setStatus(status);
  386 +// }
  387 +
328 } 388 }
329 389
src/main/java/com/genersoft/iot/vmp/service/IRecordInfoServer.java deleted 100644 → 0
1 -package com.genersoft.iot.vmp.service;  
2 -  
3 -import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;  
4 -import com.github.pagehelper.PageInfo;  
5 -  
6 -public interface IRecordInfoServer {  
7 - PageInfo<RecordInfo> getRecordList(int page, int count);  
8 -}  
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -118,7 +118,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -118,7 +118,7 @@ public class DeviceServiceImpl implements IDeviceService {
118 118
119 // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 119 // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
120 if (device.getCreateTime() == null) { 120 if (device.getCreateTime() == null) {
121 - device.setOnline(1); 121 + device.setOnline(true);
122 device.setCreateTime(now); 122 device.setCreateTime(now);
123 logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); 123 logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
124 deviceMapper.add(device); 124 deviceMapper.add(device);
@@ -130,8 +130,8 @@ public class DeviceServiceImpl implements IDeviceService { @@ -130,8 +130,8 @@ public class DeviceServiceImpl implements IDeviceService {
130 } 130 }
131 sync(device); 131 sync(device);
132 }else { 132 }else {
133 - if(device.getOnline() == 0){  
134 - device.setOnline(1); 133 + if(!device.isOnline()){
  134 + device.setOnline(true);
135 device.setCreateTime(now); 135 device.setCreateTime(now);
136 deviceMapper.update(device); 136 deviceMapper.update(device);
137 redisCatchStorage.updateDevice(device); 137 redisCatchStorage.updateDevice(device);
@@ -185,7 +185,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -185,7 +185,7 @@ public class DeviceServiceImpl implements IDeviceService {
185 } 185 }
186 String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId; 186 String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
187 dynamicTask.stop(registerExpireTaskKey); 187 dynamicTask.stop(registerExpireTaskKey);
188 - device.setOnline(0); 188 + device.setOnline(false);
189 redisCatchStorage.updateDevice(device); 189 redisCatchStorage.updateDevice(device);
190 deviceMapper.update(device); 190 deviceMapper.update(device);
191 //进行通道离线 191 //进行通道离线
@@ -231,7 +231,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -231,7 +231,7 @@ public class DeviceServiceImpl implements IDeviceService {
231 } 231 }
232 logger.info("[移除目录订阅]: {}", device.getDeviceId()); 232 logger.info("[移除目录订阅]: {}", device.getDeviceId());
233 String taskKey = device.getDeviceId() + "catalog"; 233 String taskKey = device.getDeviceId() + "catalog";
234 - if (device.getOnline() == 1) { 234 + if (device.isOnline()) {
235 Runnable runnable = dynamicTask.get(taskKey); 235 Runnable runnable = dynamicTask.get(taskKey);
236 if (runnable instanceof ISubscribeTask) { 236 if (runnable instanceof ISubscribeTask) {
237 ISubscribeTask subscribeTask = (ISubscribeTask) runnable; 237 ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@@ -264,7 +264,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -264,7 +264,7 @@ public class DeviceServiceImpl implements IDeviceService {
264 } 264 }
265 logger.info("[移除移动位置订阅]: {}", device.getDeviceId()); 265 logger.info("[移除移动位置订阅]: {}", device.getDeviceId());
266 String taskKey = device.getDeviceId() + "mobile_position"; 266 String taskKey = device.getDeviceId() + "mobile_position";
267 - if (device.getOnline() == 1) { 267 + if (device.isOnline()) {
268 Runnable runnable = dynamicTask.get(taskKey); 268 Runnable runnable = dynamicTask.get(taskKey);
269 if (runnable instanceof ISubscribeTask) { 269 if (runnable instanceof ISubscribeTask) {
270 ISubscribeTask subscribeTask = (ISubscribeTask) runnable; 270 ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@@ -331,7 +331,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -331,7 +331,7 @@ public class DeviceServiceImpl implements IDeviceService {
331 331
332 @Override 332 @Override
333 public void checkDeviceStatus(Device device) { 333 public void checkDeviceStatus(Device device) {
334 - if (device == null || device.getOnline() == 0) { 334 + if (device == null || !device.isOnline()) {
335 return; 335 return;
336 } 336 }
337 try { 337 try {
@@ -535,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -535,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService {
535 535
536 if (haveChannel) { 536 if (haveChannel) {
537 // 查询那些civilCode不在通道中的不规范通道,放置在根目录 537 // 查询那些civilCode不在通道中的不规范通道,放置在根目录
538 - List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId); 538 + List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId);
539 if (nonstandardNode != null && nonstandardNode.size() > 0) { 539 if (nonstandardNode != null && nonstandardNode.size() > 0) {
540 result.addAll(nonstandardNode); 540 result.addAll(nonstandardNode);
541 } 541 }
@@ -568,7 +568,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -568,7 +568,7 @@ public class DeviceServiceImpl implements IDeviceService {
568 568
569 @Override 569 @Override
570 public void addDevice(Device device) { 570 public void addDevice(Device device) {
571 - device.setOnline(0); 571 + device.setOnline(false);
572 device.setCreateTime(DateUtil.getNow()); 572 device.setCreateTime(DateUtil.getNow());
573 device.setUpdateTime(DateUtil.getNow()); 573 device.setUpdateTime(DateUtil.getNow());
574 deviceMapper.addCustomDevice(device); 574 deviceMapper.addCustomDevice(device);
src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java deleted 100644 → 0
1 -package com.genersoft.iot.vmp.service.impl;  
2 -  
3 -import com.genersoft.iot.vmp.service.IRecordInfoServer;  
4 -import com.genersoft.iot.vmp.storager.dao.RecordInfoDao;  
5 -import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;  
6 -import com.github.pagehelper.PageHelper;  
7 -import com.github.pagehelper.PageInfo;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.stereotype.Service;  
10 -  
11 -import java.util.List;  
12 -  
13 -@Service  
14 -public class RecordInfoServerImpl implements IRecordInfoServer {  
15 -  
16 - @Autowired  
17 - private RecordInfoDao recordInfoDao;  
18 -  
19 - @Override  
20 - public PageInfo<RecordInfo> getRecordList(int page, int count) {  
21 - PageHelper.startPage(page, count);  
22 - List<RecordInfo> all = recordInfoDao.selectAll();  
23 - return new PageInfo<>(all);  
24 - }  
25 -}  
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
332 @Override 332 @Override
333 public void zlmServerOnline(String mediaServerId) { 333 public void zlmServerOnline(String mediaServerId) {
334 // 移除开启了无人观看自动移除的流 334 // 移除开启了无人观看自动移除的流
335 - List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); 335 + List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
336 if (streamProxyItemList.size() > 0) { 336 if (streamProxyItemList.size() > 0) {
337 gbStreamMapper.batchDel(streamProxyItemList); 337 gbStreamMapper.batchDel(streamProxyItemList);
338 } 338 }
@@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
360 @Override 360 @Override
361 public void zlmServerOffline(String mediaServerId) { 361 public void zlmServerOffline(String mediaServerId) {
362 // 移除开启了无人观看自动移除的流 362 // 移除开启了无人观看自动移除的流
363 - List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); 363 + List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
364 if (streamProxyItemList.size() > 0) { 364 if (streamProxyItemList.size() > 0) {
365 gbStreamMapper.batchDel(streamProxyItemList); 365 gbStreamMapper.batchDel(streamProxyItemList);
366 } 366 }
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
@@ -16,32 +16,32 @@ import java.util.List; @@ -16,32 +16,32 @@ import java.util.List;
16 @Repository 16 @Repository
17 public interface DeviceAlarmMapper { 17 public interface DeviceAlarmMapper {
18 18
19 - @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + 19 + @Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
20 "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})") 20 "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})")
21 int add(DeviceAlarm alarm); 21 int add(DeviceAlarm alarm);
22 22
23 23
24 @Select( value = {" <script>" + 24 @Select( value = {" <script>" +
25 - " SELECT * FROM device_alarm " + 25 + " SELECT * FROM wvp_device_alarm " +
26 " WHERE 1=1 " + 26 " WHERE 1=1 " +
27 - " <if test=\"deviceId != null\" > AND deviceId = #{deviceId}</if>" +  
28 - " <if test=\"alarmPriority != null\" > AND alarmPriority = #{alarmPriority} </if>" +  
29 - " <if test=\"alarmMethod != null\" > AND alarmMethod = #{alarmMethod} </if>" +  
30 - " <if test=\"alarmType != null\" > AND alarmType = #{alarmType} </if>" +  
31 - " <if test=\"startTime != null\" > AND alarmTime &gt;= #{startTime} </if>" +  
32 - " <if test=\"endTime != null\" > AND alarmTime &lt;= #{endTime} </if>" +  
33 - " ORDER BY alarmTime ASC " + 27 + " <if test=\"deviceId != null\" > AND device_id = #{deviceId}</if>" +
  28 + " <if test=\"alarmPriority != null\" > AND alarm_priority = #{alarmPriority} </if>" +
  29 + " <if test=\"alarmMethod != null\" > AND alarm_method = #{alarmMethod} </if>" +
  30 + " <if test=\"alarmType != null\" > AND alarm_type = #{alarmType} </if>" +
  31 + " <if test=\"startTime != null\" > AND alarm_time &gt;= #{startTime} </if>" +
  32 + " <if test=\"endTime != null\" > AND alarm_time &lt;= #{endTime} </if>" +
  33 + " ORDER BY alarm_time ASC " +
34 " </script>"}) 34 " </script>"})
35 List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, 35 List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
36 String alarmType, String startTime, String endTime); 36 String alarmType, String startTime, String endTime);
37 37
38 38
39 @Delete(" <script>" + 39 @Delete(" <script>" +
40 - "DELETE FROM device_alarm WHERE 1=1 " +  
41 - " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " + 40 + "DELETE FROM wvp_device_alarm WHERE 1=1 " +
  41 + " <if test=\"deviceIdList != null and id == null \" > AND device_id in " +
42 "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + 42 "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
43 "</if>" + 43 "</if>" +
44 - " <if test=\"time != null and id == null \" > AND alarmTime &lt;= #{time}</if>" + 44 + " <if test=\"time != null and id == null \" > AND alarm_time &lt;= #{time}</if>" +
45 " <if test=\"id != null\" > AND id = #{id}</if>" + 45 " <if test=\"id != null\" > AND id = #{id}</if>" +
46 " </script>" 46 " </script>"
47 ) 47 )
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -18,10 +18,10 @@ import java.util.List; @@ -18,10 +18,10 @@ import java.util.List;
18 @Repository 18 @Repository
19 public interface DeviceChannelMapper { 19 public interface DeviceChannelMapper {
20 20
21 - @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +  
22 - "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +  
23 - "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +  
24 - "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + 21 + @Insert("INSERT INTO wvp_device_channel (channel_id, device_id, name, manufacture, model, owner, civil_code, block, " +
  22 + "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
  23 + "ip_address, port, password, ptz_type, status, stream_id, longitude, latitude, longitude_gcj02, latitude_gcj02, " +
  24 + "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time) " +
25 "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + 25 "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," +
26 "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + 26 "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " +
27 "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + 27 "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " +
@@ -29,39 +29,39 @@ public interface DeviceChannelMapper { @@ -29,39 +29,39 @@ public interface DeviceChannelMapper {
29 int add(DeviceChannel channel); 29 int add(DeviceChannel channel);
30 30
31 @Update(value = {" <script>" + 31 @Update(value = {" <script>" +
32 - "UPDATE device_channel " +  
33 - "SET updateTime=#{updateTime}" + 32 + "UPDATE wvp_device_channel " +
  33 + "SET update_time=#{updateTime}" +
34 "<if test='name != null'>, name=#{name}</if>" + 34 "<if test='name != null'>, name=#{name}</if>" +
35 "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + 35 "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
36 "<if test='model != null'>, model=#{model}</if>" + 36 "<if test='model != null'>, model=#{model}</if>" +
37 "<if test='owner != null'>, owner=#{owner}</if>" + 37 "<if test='owner != null'>, owner=#{owner}</if>" +
38 - "<if test='civilCode != null'>, civilCode=#{civilCode}</if>" + 38 + "<if test='civilCode != null'>, civil_code=#{civilCode}</if>" +
39 "<if test='block != null'>, block=#{block}</if>" + 39 "<if test='block != null'>, block=#{block}</if>" +
40 "<if test='address != null'>, address=#{address}</if>" + 40 "<if test='address != null'>, address=#{address}</if>" +
41 "<if test='parental != null'>, parental=#{parental}</if>" + 41 "<if test='parental != null'>, parental=#{parental}</if>" +
42 - "<if test='parentId != null'>, parentId=#{parentId}</if>" +  
43 - "<if test='safetyWay != null'>, safetyWay=#{safetyWay}</if>" +  
44 - "<if test='registerWay != null'>, registerWay=#{registerWay}</if>" +  
45 - "<if test='certNum != null'>, certNum=#{certNum}</if>" + 42 + "<if test='parentId != null'>, parent_id=#{parentId}</if>" +
  43 + "<if test='safetyWay != null'>, safety_way=#{safetyWay}</if>" +
  44 + "<if test='registerWay != null'>, register_way=#{registerWay}</if>" +
  45 + "<if test='certNum != null'>, cert_num=#{certNum}</if>" +
46 "<if test='certifiable != null'>, certifiable=#{certifiable}</if>" + 46 "<if test='certifiable != null'>, certifiable=#{certifiable}</if>" +
47 - "<if test='errCode != null'>, errCode=#{errCode}</if>" + 47 + "<if test='errCode != null'>, err_code=#{errCode}</if>" +
48 "<if test='secrecy != null'>, secrecy=#{secrecy}</if>" + 48 "<if test='secrecy != null'>, secrecy=#{secrecy}</if>" +
49 - "<if test='ipAddress != null'>, ipAddress=#{ipAddress}</if>" + 49 + "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" +
50 "<if test='port != null'>, port=#{port}</if>" + 50 "<if test='port != null'>, port=#{port}</if>" +
51 "<if test='password != null'>, password=#{password}</if>" + 51 "<if test='password != null'>, password=#{password}</if>" +
52 - "<if test='PTZType != null'>, PTZType=#{PTZType}</if>" + 52 + "<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" +
53 "<if test='status != null'>, status=#{status}</if>" + 53 "<if test='status != null'>, status=#{status}</if>" +
54 - "<if test='streamId != null'>, streamId=#{streamId}</if>" +  
55 - "<if test='hasAudio != null'>, hasAudio=#{hasAudio}</if>" + 54 + "<if test='streamId != null'>, stream_id=#{streamId}</if>" +
  55 + "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
56 "<if test='longitude != null'>, longitude=#{longitude}</if>" + 56 "<if test='longitude != null'>, longitude=#{longitude}</if>" +
57 "<if test='latitude != null'>, latitude=#{latitude}</if>" + 57 "<if test='latitude != null'>, latitude=#{latitude}</if>" +
58 - "<if test='longitudeGcj02 != null'>, longitudeGcj02=#{longitudeGcj02}</if>" +  
59 - "<if test='latitudeGcj02 != null'>, latitudeGcj02=#{latitudeGcj02}</if>" +  
60 - "<if test='longitudeWgs84 != null'>, longitudeWgs84=#{longitudeWgs84}</if>" +  
61 - "<if test='latitudeWgs84 != null'>, latitudeWgs84=#{latitudeWgs84}</if>" +  
62 - "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +  
63 - "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +  
64 - "WHERE deviceId=#{deviceId} AND channelId=#{channelId}"+ 58 + "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
  59 + "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
  60 + "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
  61 + "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" +
  62 + "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" +
  63 + "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" +
  64 + "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+
65 " </script>"}) 65 " </script>"})
66 int update(DeviceChannel channel); 66 int update(DeviceChannel channel);
67 67
@@ -69,42 +69,42 @@ public interface DeviceChannelMapper { @@ -69,42 +69,42 @@ public interface DeviceChannelMapper {
69 "SELECT " + 69 "SELECT " +
70 "dc.* " + 70 "dc.* " +
71 "from " + 71 "from " +
72 - "device_channel dc " + 72 + "wvp_device_channel dc " +
73 "WHERE " + 73 "WHERE " +
74 - "dc.deviceId = #{deviceId} " +  
75 -" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +  
76 - " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " + 74 + "dc.device_id = #{deviceId} " +
  75 +" <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
  76 + " <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) </if> " +
77 " <if test='online == true' > AND dc.status=1</if>" + 77 " <if test='online == true' > AND dc.status=1</if>" +
78 " <if test='online == false' > AND dc.status=0</if>" + 78 " <if test='online == false' > AND dc.status=0</if>" +
79 - " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +  
80 - " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +  
81 - "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + 79 + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
  80 + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
  81 + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
82 "#{item} " + 82 "#{item} " +
83 "</foreach> </if>" + 83 "</foreach> </if>" +
84 - "ORDER BY dc.channelId " + 84 + "ORDER BY dc.channel_id " +
85 " </script>"}) 85 " </script>"})
86 List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); 86 List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
87 87
88 @Select(value = {" <script>" + 88 @Select(value = {" <script>" +
89 "SELECT " + 89 "SELECT " +
90 "dc.*, " + 90 "dc.*, " +
91 - "de.name as deviceName, " +  
92 - "de.online as deviceOnline " + 91 + "de.name as device_name, " +
  92 + "de.online as device_online " +
93 "from " + 93 "from " +
94 - "device_channel dc " +  
95 - "LEFT JOIN device de ON dc.deviceId = de.deviceId " + 94 + "wvp_device_channel dc " +
  95 + "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
96 "WHERE 1=1" + 96 "WHERE 1=1" +
97 - " <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " +  
98 - " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +  
99 - " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + 97 + " <if test='device_id != null'> AND dc.device_id = #{deviceId} </if> " +
  98 + " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
  99 + " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
100 " <if test='online == true' > AND dc.status=1</if>" + 100 " <if test='online == true' > AND dc.status=1</if>" +
101 " <if test='online == false' > AND dc.status=0</if>" + 101 " <if test='online == false' > AND dc.status=0</if>" +
102 - " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +  
103 - " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +  
104 - "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + 102 + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
  103 + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
  104 + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
105 "#{item} " + 105 "#{item} " +
106 "</foreach> </if>" + 106 "</foreach> </if>" +
107 - "ORDER BY dc.channelId ASC" + 107 + "ORDER BY dc.channel_id ASC" +
108 " </script>"}) 108 " </script>"})
109 List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); 109 List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
110 110
@@ -112,151 +112,97 @@ public interface DeviceChannelMapper { @@ -112,151 +112,97 @@ public interface DeviceChannelMapper {
112 @Select(value = {" <script>" + 112 @Select(value = {" <script>" +
113 "SELECT " + 113 "SELECT " +
114 "dc.*, " + 114 "dc.*, " +
115 - "de.name as deviceName, " +  
116 - "de.online as deviceOnline " + 115 + "de.name as device_name, " +
  116 + "de.online as device_online " +
117 "from " + 117 "from " +
118 - "device_channel dc " +  
119 - "LEFT JOIN device de ON dc.deviceId = de.deviceId " + 118 + "wvp_device_channel dc " +
  119 + "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
120 "WHERE 1=1" + 120 "WHERE 1=1" +
121 - " <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " +  
122 - " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +  
123 - " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + 121 + " <if test='deviceId != null'> AND dc.device_id = #{deviceId} </if> " +
  122 + " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
  123 + " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
124 " <if test='online == true' > AND dc.status=1</if>" + 124 " <if test='online == true' > AND dc.status=1</if>" +
125 " <if test='online == false' > AND dc.status=0</if>" + 125 " <if test='online == false' > AND dc.status=0</if>" +
126 - " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +  
127 - " <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +  
128 - "<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + 126 + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
  127 + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
  128 + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
129 "#{item} " + 129 "#{item} " +
130 "</foreach> </if>" + 130 "</foreach> </if>" +
131 - "ORDER BY dc.channelId ASC " + 131 + "ORDER BY dc.channel_id ASC " +
132 "Limit #{limit} OFFSET #{start}" + 132 "Limit #{limit} OFFSET #{start}" +
133 " </script>"}) 133 " </script>"})
134 List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query, 134 List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query,
135 Boolean hasSubChannel, Boolean online, int start, int limit); 135 Boolean hasSubChannel, Boolean online, int start, int limit);
136 136
137 - @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") 137 + @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
138 DeviceChannel queryChannel(String deviceId, String channelId); 138 DeviceChannel queryChannel(String deviceId, String channelId);
139 139
140 - @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId}") 140 + @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}")
141 int cleanChannelsByDeviceId(String deviceId); 141 int cleanChannelsByDeviceId(String deviceId);
142 142
143 - @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") 143 + @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
144 int del(String deviceId, String channelId); 144 int del(String deviceId, String channelId);
145 145
146 - @Update(value = {"UPDATE device_channel SET streamId=null WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) 146 + @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
147 void stopPlay(String deviceId, String channelId); 147 void stopPlay(String deviceId, String channelId);
148 148
149 - @Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) 149 + @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
150 void startPlay(String deviceId, String channelId, String streamId); 150 void startPlay(String deviceId, String channelId, String streamId);
151 151
152 @Select(value = {" <script>" + 152 @Select(value = {" <script>" +
153 "SELECT " + 153 "SELECT " +
154 " dc.id,\n" + 154 " dc.id,\n" +
155 - " dc.channelId,\n" +  
156 - " dc.deviceId,\n" + 155 + " dc.channel_id,\n" +
  156 + " dc.device_id,\n" +
157 " dc.name,\n" + 157 " dc.name,\n" +
158 " de.manufacturer,\n" + 158 " de.manufacturer,\n" +
159 - " de.hostAddress,\n" +  
160 - " dc.subCount,\n" +  
161 - " pgc.platformId as platformId,\n" +  
162 - " pgc.catalogId as catalogId " +  
163 - " FROM device_channel dc " +  
164 - " LEFT JOIN device de ON dc.deviceId = de.deviceId " +  
165 - " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + 159 + " de.host_address,\n" +
  160 + " dc.sub_count,\n" +
  161 + " pgc.platform_id as platform_id,\n" +
  162 + " pgc.catalog_id as catalog_id " +
  163 + " FROM wvp_device_channel dc " +
  164 + " LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
  165 + " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
166 " WHERE 1=1 " + 166 " WHERE 1=1 " +
167 - " <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + 167 + " <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
168 " <if test='online == true' > AND dc.status=1</if> " + 168 " <if test='online == true' > AND dc.status=1</if> " +
169 " <if test='online == false' > AND dc.status=0</if> " + 169 " <if test='online == false' > AND dc.status=0</if> " +
170 - " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " +  
171 - " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " +  
172 - " <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " +  
173 - " <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " +  
174 - " ORDER BY dc.deviceId, dc.channelId ASC" + 170 + " <if test='hasSubChannel!= null and has_sub_channel == true' > AND dc.sub_count > 0</if> " +
  171 + " <if test='hasSubChannel!= null and has_sub_channel == false' > AND dc.sub_count = 0</if> " +
  172 + " <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_gb_channel where platform_id=#{platformId} ) </if> " +
  173 + " <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
  174 + " ORDER BY dc.device_id, dc.channel_id ASC" +
175 " </script>"}) 175 " </script>"})
176 List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); 176 List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
177 177
178 @Select(value = {" <script>" + 178 @Select(value = {" <script>" +
179 "SELECT " + 179 "SELECT " +
180 " dc.*,\n" + 180 " dc.*,\n" +
181 - " pgc.platformId as platformId,\n" +  
182 - " pgc.catalogId as catalogId " +  
183 - " FROM device_channel dc " +  
184 - " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +  
185 - " WHERE pgc.platformId = #{platformId} " +  
186 - " ORDER BY dc.deviceId, dc.channelId ASC" + 181 + " pgc.platform_id as platform_id,\n" +
  182 + " pgc.catalog_id as catalog_id " +
  183 + " FROM wvp_device_channel dc " +
  184 + " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
  185 + " WHERE pgc.platform_id = #{platformId} " +
  186 + " ORDER BY dc.device_id, dc.channel_id ASC" +
187 " </script>"}) 187 " </script>"})
188 List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId); 188 List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
189 189
190 190
191 - @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") 191 + @Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}")
192 List<DeviceChannel> queryChannelByChannelId( String channelId); 192 List<DeviceChannel> queryChannelByChannelId( String channelId);
193 193
194 - @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) 194 + @Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
195 void offline(String deviceId, String channelId); 195 void offline(String deviceId, String channelId);
196 196
197 - @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"}) 197 + @Update(value = {"UPDATE wvp_device_channel SET status=0 WHERE device_id=#{deviceId}"})
198 void offlineByDeviceId(String deviceId); 198 void offlineByDeviceId(String deviceId);
199 199
200 -// @Insert("<script> " +  
201 -// "insert into device_channel " +  
202 -// "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +  
203 -// " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +  
204 -// " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +  
205 -// " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +  
206 -// "values " +  
207 -// "<foreach collection='addChannels' index='index' item='item' separator=','> " +  
208 -// "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +  
209 -// "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," +  
210 -// "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " +  
211 -// "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " +  
212 -// "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " +  
213 -// "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " +  
214 -// "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " +  
215 -// "#{item.businessGroupId}, #{item.gpsTime}) " +  
216 -// "</foreach> " +  
217 -// "ON DUPLICATE KEY UPDATE " +  
218 -// "updateTime=VALUES(updateTime), " +  
219 -// "name=VALUES(name), " +  
220 -// "manufacture=VALUES(manufacture), " +  
221 -// "model=VALUES(model), " +  
222 -// "owner=VALUES(owner), " +  
223 -// "civilCode=VALUES(civilCode), " +  
224 -// "block=VALUES(block), " +  
225 -// "subCount=VALUES(subCount), " +  
226 -// "address=VALUES(address), " +  
227 -// "parental=VALUES(parental), " +  
228 -// "parentId=VALUES(parentId), " +  
229 -// "safetyWay=VALUES(safetyWay), " +  
230 -// "registerWay=VALUES(registerWay), " +  
231 -// "certNum=VALUES(certNum), " +  
232 -// "certifiable=VALUES(certifiable), " +  
233 -// "errCode=VALUES(errCode), " +  
234 -// "secrecy=VALUES(secrecy), " +  
235 -// "ipAddress=VALUES(ipAddress), " +  
236 -// "port=VALUES(port), " +  
237 -// "password=VALUES(password), " +  
238 -// "PTZType=VALUES(PTZType), " +  
239 -// "status=VALUES(status), " +  
240 -// "streamId=VALUES(streamId), " +  
241 -// "longitude=VALUES(longitude), " +  
242 -// "latitude=VALUES(latitude), " +  
243 -// "longitudeGcj02=VALUES(longitudeGcj02), " +  
244 -// "latitudeGcj02=VALUES(latitudeGcj02), " +  
245 -// "longitudeWgs84=VALUES(longitudeWgs84), " +  
246 -// "latitudeWgs84=VALUES(latitudeWgs84), " +  
247 -// "hasAudio=VALUES(hasAudio), " +  
248 -// "businessGroupId=VALUES(businessGroupId), " +  
249 -// "gpsTime=VALUES(gpsTime)" +  
250 -// "</script>")  
251 -// int batchAdd(List<DeviceChannel> addChannels);  
252 -  
253 -  
254 @Insert("<script> " + 200 @Insert("<script> " +
255 - "insert into device_channel " +  
256 - "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +  
257 - " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +  
258 - " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +  
259 - " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + 201 + "insert into wvp_device_channel " +
  202 + "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " +
  203 + " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
  204 + " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
  205 + " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+
260 "values " + 206 "values " +
261 "<foreach collection='addChannels' index='index' item='item' separator=','> " + 207 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
262 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + 208 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@@ -273,11 +219,11 @@ public interface DeviceChannelMapper { @@ -273,11 +219,11 @@ public interface DeviceChannelMapper {
273 219
274 220
275 @Insert("<script> " + 221 @Insert("<script> " +
276 - "insert into device_channel " +  
277 - "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +  
278 - " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +  
279 - " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +  
280 - " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + 222 + "insert into wvp_device_channel " +
  223 + "(channel_id,device_id,name,manufacture,model,owner,civil_code,block,sub_count,"+
  224 + " address,parental,parent_id,safety_way,register_way,cert_num,certifiable,err_code,secrecy,"+
  225 + " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
  226 + " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+
281 "values " + 227 "values " +
282 "<foreach collection='addChannels' index='index' item='item' separator=','> " + 228 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
283 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + 229 "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@@ -290,214 +236,214 @@ public interface DeviceChannelMapper { @@ -290,214 +236,214 @@ public interface DeviceChannelMapper {
290 "#{item.businessGroupId}, #{item.gpsTime}) " + 236 "#{item.businessGroupId}, #{item.gpsTime}) " +
291 "</foreach> " + 237 "</foreach> " +
292 "ON DUPLICATE KEY UPDATE " + 238 "ON DUPLICATE KEY UPDATE " +
293 - "updateTime=VALUES(updateTime), " + 239 + "update_time=VALUES(update_time), " +
294 "name=VALUES(name), " + 240 "name=VALUES(name), " +
295 "manufacture=VALUES(manufacture), " + 241 "manufacture=VALUES(manufacture), " +
296 "model=VALUES(model), " + 242 "model=VALUES(model), " +
297 "owner=VALUES(owner), " + 243 "owner=VALUES(owner), " +
298 - "civilCode=VALUES(civilCode), " + 244 + "civil_code=VALUES(civil_code), " +
299 "block=VALUES(block), " + 245 "block=VALUES(block), " +
300 - "subCount=VALUES(subCount), " + 246 + "sub_count=VALUES(sub_count), " +
301 "address=VALUES(address), " + 247 "address=VALUES(address), " +
302 "parental=VALUES(parental), " + 248 "parental=VALUES(parental), " +
303 - "parentId=VALUES(parentId), " +  
304 - "safetyWay=VALUES(safetyWay), " +  
305 - "registerWay=VALUES(registerWay), " +  
306 - "certNum=VALUES(certNum), " + 249 + "parent_id=VALUES(parent_id), " +
  250 + "safety_way=VALUES(safety_way), " +
  251 + "register_way=VALUES(register_way), " +
  252 + "cert_num=VALUES(cert_num), " +
307 "certifiable=VALUES(certifiable), " + 253 "certifiable=VALUES(certifiable), " +
308 - "errCode=VALUES(errCode), " + 254 + "err_code=VALUES(err_code), " +
309 "secrecy=VALUES(secrecy), " + 255 "secrecy=VALUES(secrecy), " +
310 - "ipAddress=VALUES(ipAddress), " + 256 + "ip_address=VALUES(ip_address), " +
311 "port=VALUES(port), " + 257 "port=VALUES(port), " +
312 "password=VALUES(password), " + 258 "password=VALUES(password), " +
313 - "PTZType=VALUES(PTZType), " + 259 + "ptz_type=VALUES(ptz_type), " +
314 "status=VALUES(status), " + 260 "status=VALUES(status), " +
315 - "streamId=VALUES(streamId), " + 261 + "stream_id=VALUES(stream_id), " +
316 "longitude=VALUES(longitude), " + 262 "longitude=VALUES(longitude), " +
317 "latitude=VALUES(latitude), " + 263 "latitude=VALUES(latitude), " +
318 - "longitudeGcj02=VALUES(longitudeGcj02), " +  
319 - "latitudeGcj02=VALUES(latitudeGcj02), " +  
320 - "longitudeWgs84=VALUES(longitudeWgs84), " +  
321 - "latitudeWgs84=VALUES(latitudeWgs84), " +  
322 - "hasAudio=VALUES(hasAudio), " +  
323 - "businessGroupId=VALUES(businessGroupId), " +  
324 - "gpsTime=VALUES(gpsTime)" + 264 + "longitude_gcj02=VALUES(longitude_gcj02), " +
  265 + "latitude_gcj02=VALUES(latitude_gcj02), " +
  266 + "longitude_wgs84=VALUES(longitude_wgs84), " +
  267 + "latitude_wgs84=VALUES(latitude_wgs84), " +
  268 + "has_audio=VALUES(has_audio), " +
  269 + "business_group_id=VALUES(business_group_id), " +
  270 + "gps_time=VALUES(gps_time)" +
325 "</script>") 271 "</script>")
326 int batchAddOrUpdate(List<DeviceChannel> addChannels); 272 int batchAddOrUpdate(List<DeviceChannel> addChannels);
327 273
328 - @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) 274 + @Update(value = {"UPDATE wvp_device_channel SET status=1 WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
329 void online(String deviceId, String channelId); 275 void online(String deviceId, String channelId);
330 276
331 @Update({"<script>" + 277 @Update({"<script>" +
332 "<foreach collection='updateChannels' item='item' separator=';'>" + 278 "<foreach collection='updateChannels' item='item' separator=';'>" +
333 " UPDATE" + 279 " UPDATE" +
334 - " device_channel" +  
335 - " SET updateTime=#{item.updateTime}" + 280 + " wvp_device_channel" +
  281 + " SET update_time=#{item.updateTime}" +
336 "<if test='item.name != null'>, name=#{item.name}</if>" + 282 "<if test='item.name != null'>, name=#{item.name}</if>" +
337 "<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" + 283 "<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" +
338 "<if test='item.model != null'>, model=#{item.model}</if>" + 284 "<if test='item.model != null'>, model=#{item.model}</if>" +
339 "<if test='item.owner != null'>, owner=#{item.owner}</if>" + 285 "<if test='item.owner != null'>, owner=#{item.owner}</if>" +
340 - "<if test='item.civilCode != null'>, civilCode=#{item.civilCode}</if>" + 286 + "<if test='item.civil_code != null'>, civil_code=#{item.civilCode}</if>" +
341 "<if test='item.block != null'>, block=#{item.block}</if>" + 287 "<if test='item.block != null'>, block=#{item.block}</if>" +
342 - "<if test='item.subCount != null'>, subCount=#{item.subCount}</if>" + 288 + "<if test='item.subCount != null'>, sub_count=#{item.subCount}</if>" +
343 "<if test='item.address != null'>, address=#{item.address}</if>" + 289 "<if test='item.address != null'>, address=#{item.address}</if>" +
344 "<if test='item.parental != null'>, parental=#{item.parental}</if>" + 290 "<if test='item.parental != null'>, parental=#{item.parental}</if>" +
345 - "<if test='item.parentId != null'>, parentId=#{item.parentId}</if>" +  
346 - "<if test='item.safetyWay != null'>, safetyWay=#{item.safetyWay}</if>" +  
347 - "<if test='item.registerWay != null'>, registerWay=#{item.registerWay}</if>" +  
348 - "<if test='item.certNum != null'>, certNum=#{item.certNum}</if>" + 291 + "<if test='item.parentId != null'>, parent_id=#{item.parentId}</if>" +
  292 + "<if test='item.safetyWay != null'>, safety_way=#{item.safetyWay}</if>" +
  293 + "<if test='item.registerWay != null'>, register_way=#{item.registerWay}</if>" +
  294 + "<if test='item.certNum != null'>, cert_num=#{item.certNum}</if>" +
349 "<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" + 295 "<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" +
350 - "<if test='item.errCode != null'>, errCode=#{item.errCode}</if>" + 296 + "<if test='item.errCode != null'>, err_code=#{item.errCode}</if>" +
351 "<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" + 297 "<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" +
352 - "<if test='item.ipAddress != null'>, ipAddress=#{item.ipAddress}</if>" + 298 + "<if test='item.ipAddress != null'>, ip_address=#{item.ipAddress}</if>" +
353 "<if test='item.port != null'>, port=#{item.port}</if>" + 299 "<if test='item.port != null'>, port=#{item.port}</if>" +
354 "<if test='item.password != null'>, password=#{item.password}</if>" + 300 "<if test='item.password != null'>, password=#{item.password}</if>" +
355 - "<if test='item.PTZType != null'>, PTZType=#{item.PTZType}</if>" + 301 + "<if test='item.PTZType != null'>, ptz_type=#{item.PTZType}</if>" +
356 "<if test='item.status != null'>, status=#{item.status}</if>" + 302 "<if test='item.status != null'>, status=#{item.status}</if>" +
357 - "<if test='item.streamId != null'>, streamId=#{item.streamId}</if>" +  
358 - "<if test='item.hasAudio != null'>, hasAudio=#{item.hasAudio}</if>" + 303 + "<if test='item.streamId != null'>, stream_id=#{item.streamId}</if>" +
  304 + "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" +
359 "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + 305 "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
360 "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + 306 "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
361 - "<if test='item.longitudeGcj02 != null'>, longitudeGcj02=#{item.longitudeGcj02}</if>" +  
362 - "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=#{item.latitudeGcj02}</if>" +  
363 - "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=#{item.longitudeWgs84}</if>" +  
364 - "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=#{item.latitudeWgs84}</if>" +  
365 - "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +  
366 - "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" + 307 + "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
  308 + "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
  309 + "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
  310 + "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
  311 + "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" +
  312 + "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
367 "<if test='item.id > 0'>WHERE id=#{item.id}</if>" + 313 "<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
368 - "<if test='item.id == 0'>WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}</if>" + 314 + "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" +
369 "</foreach>" + 315 "</foreach>" +
370 "</script>"}) 316 "</script>"})
371 int batchUpdate(List<DeviceChannel> updateChannels); 317 int batchUpdate(List<DeviceChannel> updateChannels);
372 318
373 319
374 - @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1") 320 + @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND status=1")
375 List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); 321 List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);
376 322
377 @Delete(value = {" <script>" + 323 @Delete(value = {" <script>" +
378 "DELETE " + 324 "DELETE " +
379 "from " + 325 "from " +
380 - "device_channel " + 326 + "wvp_device_channel " +
381 "WHERE " + 327 "WHERE " +
382 - "deviceId = #{deviceId} " +  
383 - " AND channelId NOT IN " + 328 + "device_id = #{deviceId} " +
  329 + " AND channel_id NOT IN " +
384 "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" + 330 "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" +
385 " </script>"}) 331 " </script>"})
386 int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels); 332 int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels);
387 333
388 - @Update(" update device_channel" +  
389 - " set subCount = (select *" + 334 + @Update(" update wvp_device_channel" +
  335 + " set sub_count = (select *" +
390 " from (select count(0)" + 336 " from (select count(0)" +
391 - " from device_channel" +  
392 - " where deviceId = #{deviceId} and parentId = #{channelId}) as temp)" +  
393 - " where deviceId = #{deviceId} " +  
394 - " and channelId = #{channelId}") 337 + " from wvp_device_channel" +
  338 + " where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" +
  339 + " where device_id = #{deviceId} " +
  340 + " and channel_id = #{channelId}")
395 int updateChannelSubCount(String deviceId, String channelId); 341 int updateChannelSubCount(String deviceId, String channelId);
396 342
397 @Update(value = {" <script>" + 343 @Update(value = {" <script>" +
398 - "UPDATE device_channel " + 344 + "UPDATE wvp_device_channel " +
399 "SET " + 345 "SET " +
400 "latitude=#{latitude}, " + 346 "latitude=#{latitude}, " +
401 "longitude=#{longitude}, " + 347 "longitude=#{longitude}, " +
402 - "longitudeGcj02=#{longitudeGcj02}, " +  
403 - "latitudeGcj02=#{latitudeGcj02}, " +  
404 - "longitudeWgs84=#{longitudeWgs84}, " +  
405 - "latitudeWgs84=#{latitudeWgs84}, " +  
406 - "gpsTime=#{gpsTime} " +  
407 - "WHERE deviceId=#{deviceId} " +  
408 - " <if test='channelId != null' > AND channelId=#{channelId}</if>" + 348 + "longitude_gcj02=#{longitudeGcj02}, " +
  349 + "latitude_gcj02=#{latitudeGcj02}, " +
  350 + "longitude_wgs84=#{longitudeWgs84}, " +
  351 + "latitude_wgs84=#{latitudeWgs84}, " +
  352 + "gps_time=#{gpsTime} " +
  353 + "WHERE device_id=#{deviceId} " +
  354 + " <if test='channelId != null' > AND channel_id=#{channelId}</if>" +
409 " </script>"}) 355 " </script>"})
410 void updatePosition(DeviceChannel deviceChannel); 356 void updatePosition(DeviceChannel deviceChannel);
411 357
412 - @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") 358 + @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0")
413 List<DeviceChannel> getAllChannelInPlay(); 359 List<DeviceChannel> getAllChannelInPlay();
414 360
415 - @Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}") 361 + @Select("select * from wvp_device_channel where longitude*latitude > 0 and device_id = #{deviceId}")
416 List<DeviceChannel> getAllChannelWithCoordinate(String deviceId); 362 List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
417 363
418 364
419 @Select(value = {" <script>" + 365 @Select(value = {" <script>" +
420 "select * " + 366 "select * " +
421 - "from device_channel " +  
422 - "where deviceId=#{deviceId}" +  
423 - " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} and length(channelId)=#{length} </if>" +  
424 - " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=#{length} </if>" +  
425 - " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +  
426 - " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} </if>" + 367 + "from wvp_device_channel " +
  368 + "where device_id=#{deviceId}" +
  369 + " <if test='parentId != null and length != null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} and length(channel_id)=#{length} </if>" +
  370 + " <if test='parentId == null and length != null' > and parent_id= #{parentId} or length(channel_id)=#{length} </if>" +
  371 + " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" +
  372 + " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" +
427 " </script>"}) 373 " </script>"})
428 List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); 374 List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
429 375
430 @Select(value = {" <script>" + 376 @Select(value = {" <script>" +
431 "select * " + 377 "select * " +
432 - "from device_channel " +  
433 - "where deviceId=#{deviceId} and length(channelId)>14 and civilCode=#{parentId}" + 378 + "from wvp_device_channel " +
  379 + "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" +
434 " </script>"}) 380 " </script>"})
435 List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId); 381 List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId);
436 382
437 - @Select("select min(length(channelId)) as minLength " +  
438 - "from device_channel " +  
439 - "where deviceId=#{deviceId}") 383 + @Select("select min(length(channel_id)) as minLength " +
  384 + "from wvp_device_channel " +
  385 + "where device_id=#{deviceId}")
440 Integer getChannelMinLength(String deviceId); 386 Integer getChannelMinLength(String deviceId);
441 387
442 - @Select("select * from device_channel where deviceId=#{deviceId} and civilCode not in " +  
443 - "(select civilCode from device_channel where deviceId=#{deviceId} group by civilCode)")  
444 - List<DeviceChannel> getChannelWithoutCiviCode(String deviceId); 388 + @Select("select * from wvp_device_channel where device_id=#{deviceId} and civil_code not in " +
  389 + "(select civil_code from wvp_device_channel where device_id=#{deviceId} group by civil_code)")
  390 + List<DeviceChannel> getChannelWithoutCivilCode(String deviceId);
445 391
446 - @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") 392 + @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
447 List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); 393 List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
448 394
449 - @Select("select dc.id, dc.channelId, dc.deviceId, dc.name, dc.manufacture,dc.model,dc.owner, pc.civilCode,dc.block, " +  
450 - " dc.address, '0' as parental,'0' as channelType, pc.id as parentId, dc.safetyWay, dc.registerWay,dc.certNum, dc.certifiable, " +  
451 - " dc.errCode,dc.endTime, dc.secrecy, dc.ipAddress, dc.port, dc.PTZType, dc.password, dc.status, " +  
452 - " dc.longitudeWgs84 as longitude, dc.latitudeWgs84 as latitude, pc.businessGroupId " +  
453 - " from device_channel dc" +  
454 - " left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" +  
455 - " left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" +  
456 - " where pgc.platformId=#{serverGBId}") 395 + @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
  396 + " 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, " +
  397 + " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " +
  398 + " dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " +
  399 + " from wvp_device_channel dc" +
  400 + " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
  401 + " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
  402 + " where pgc.platform_id=#{serverGBId}")
457 List<DeviceChannel> queryChannelWithCatalog(String serverGBId); 403 List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
458 404
459 - @Select("select * from device_channel where deviceId = #{deviceId}") 405 + @Select("select * from wvp_device_channel where device_id = #{deviceId}")
460 List<DeviceChannel> queryAllChannels(String deviceId); 406 List<DeviceChannel> queryAllChannels(String deviceId);
461 407
462 408
463 - @Select("select count(1) as total, sum(status) as online from device_channel") 409 + @Select("select count(1) as total, sum(status) as online from wvp_device_channel")
464 ResourceBaceInfo getOverview(); 410 ResourceBaceInfo getOverview();
465 411
466 @Select("select channelId" + 412 @Select("select channelId" +
467 - ", deviceId" + 413 + ", device_id" +
468 ", latitude" + 414 ", latitude" +
469 - ", longitude" +  
470 - ", latitudeWgs84" +  
471 - ", longitudeWgs84" +  
472 - ", latitudeGcj02" +  
473 - ", longitudeGcj02 " +  
474 - "from device_channel where deviceId = #{deviceId} " + 415 + ", longitude"+
  416 + ",latitude_wgs84"+
  417 + ",longitude_wgs84"+
  418 + ",latitude_gcj02"+
  419 + ",longitude_gcj02"+
  420 + "from wvp_device_channel where device_id = #{deviceId} " +
475 "and latitude != 0 " + 421 "and latitude != 0 " +
476 "and longitude != 0 " + 422 "and longitude != 0 " +
477 - "and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)") 423 + "and(latitude_gcj02=0orlatitude_wgs84=0orlongitude_wgs84= 0 or longitude_gcj02 = 0)")
478 List<DeviceChannel> getChannelsWithoutTransform(String deviceId); 424 List<DeviceChannel> getChannelsWithoutTransform(String deviceId);
479 425
480 - @Select("select de.* from device de left join device_channel dc on de.deviceId = dc.deviceId where dc.channelId=#{channelId}") 426 + @Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}")
481 List<Device> getDeviceByChannelId(String channelId); 427 List<Device> getDeviceByChannelId(String channelId);
482 428
483 429
484 @Delete({"<script>" + 430 @Delete({"<script>" +
485 "<foreach collection='deleteChannelList' item='item' separator=';'>" + 431 "<foreach collection='deleteChannelList' item='item' separator=';'>" +
486 - "DELETE FROM device_channel WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + 432 + "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
487 "</foreach>" + 433 "</foreach>" +
488 "</script>"}) 434 "</script>"})
489 int batchDel(List<DeviceChannel> deleteChannelList); 435 int batchDel(List<DeviceChannel> deleteChannelList);
490 436
491 @Update({"<script>" + 437 @Update({"<script>" +
492 "<foreach collection='channels' item='item' separator=';'>" + 438 "<foreach collection='channels' item='item' separator=';'>" +
493 - "UPDATE device_channel SET status=1 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + 439 + "UPDATE wvp_device_channel SET status=1 WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
494 "</foreach>" + 440 "</foreach>" +
495 "</script>"}) 441 "</script>"})
496 int batchOnline(List<DeviceChannel> channels); 442 int batchOnline(List<DeviceChannel> channels);
497 443
498 @Update({"<script>" + 444 @Update({"<script>" +
499 "<foreach collection='channels' item='item' separator=';'>" + 445 "<foreach collection='channels' item='item' separator=';'>" +
500 - "UPDATE device_channel SET status=0 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + 446 + "UPDATE wvp_device_channel SET status=0 WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
501 "</foreach>" + 447 "</foreach>" +
502 "</script>"}) 448 "</script>"})
503 int batchOffline(List<DeviceChannel> channels); 449 int batchOffline(List<DeviceChannel> channels);
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -15,68 +15,68 @@ import java.util.List; @@ -15,68 +15,68 @@ import java.util.List;
15 public interface DeviceMapper { 15 public interface DeviceMapper {
16 16
17 @Select("SELECT " + 17 @Select("SELECT " +
18 - "deviceId, " + 18 + "device_id, " +
19 "coalesce(custom_name, name) as name, " + 19 "coalesce(custom_name, name) as name, " +
20 "password, " + 20 "password, " +
21 "manufacturer, " + 21 "manufacturer, " +
22 "model, " + 22 "model, " +
23 "firmware, " + 23 "firmware, " +
24 "transport," + 24 "transport," +
25 - "streamMode," + 25 + "stream_mode," +
26 "ip," + 26 "ip," +
27 - "sdpIp," +  
28 - "localIp," + 27 + "sdp_ip," +
  28 + "local_ip," +
29 "port," + 29 "port," +
30 - "hostAddress," + 30 + "host_address," +
31 "expires," + 31 "expires," +
32 - "registerTime," +  
33 - "keepaliveTime," +  
34 - "createTime," +  
35 - "updateTime," + 32 + "register_time," +
  33 + "keepalive_time," +
  34 + "create_time," +
  35 + "update_time," +
36 "charset," + 36 "charset," +
37 - "subscribeCycleForCatalog," +  
38 - "subscribeCycleForMobilePosition," +  
39 - "mobilePositionSubmissionInterval," +  
40 - "subscribeCycleForAlarm," +  
41 - "ssrcCheck," +  
42 - "asMessageChannel," +  
43 - "geoCoordSys," +  
44 - "treeType," + 37 + "subscribe_cycle_for_catalog," +
  38 + "subscribe_cycle_for_mobile_position," +
  39 + "mobile_position_submission_interval," +
  40 + "subscribe_cycle_for_alarm," +
  41 + "ssrc_check," +
  42 + "as_message_channel," +
  43 + "geo_coord_sys," +
  44 + "tree_type," +
45 "online," + 45 "online," +
46 - "mediaServerId," +  
47 - "(SELECT count(0) FROM device_channel WHERE deviceId=device.deviceId) as channelCount "+  
48 - " FROM device WHERE deviceId = #{deviceId}") 46 + "media_server_id," +
  47 + "(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+
  48 + " FROM wvp_device WHERE device_id = #{deviceId}")
49 Device getDeviceByDeviceId(String deviceId); 49 Device getDeviceByDeviceId(String deviceId);
50 50
51 - @Insert("INSERT INTO device (" +  
52 - "deviceId, " + 51 + @Insert("INSERT INTO wvp_device (" +
  52 + "device_id, " +
53 "name, " + 53 "name, " +
54 "manufacturer, " + 54 "manufacturer, " +
55 "model, " + 55 "model, " +
56 "firmware, " + 56 "firmware, " +
57 "transport," + 57 "transport," +
58 - "streamMode," + 58 + "stream_mode," +
59 "ip," + 59 "ip," +
60 - "sdpIp," +  
61 - "localIp," + 60 + "sdp_ip," +
  61 + "local_ip," +
62 "port," + 62 "port," +
63 - "hostAddress," + 63 + "host_address," +
64 "expires," + 64 "expires," +
65 - "registerTime," +  
66 - "keepaliveTime," +  
67 - "keepaliveIntervalTime," +  
68 - "createTime," +  
69 - "updateTime," + 65 + "register_time," +
  66 + "keepalive_time," +
  67 + "keepalive_interval_time," +
  68 + "create_time," +
  69 + "update_time," +
70 "charset," + 70 "charset," +
71 - "subscribeCycleForCatalog," +  
72 - "subscribeCycleForMobilePosition," +  
73 - "mobilePositionSubmissionInterval," +  
74 - "subscribeCycleForAlarm," +  
75 - "ssrcCheck," +  
76 - "asMessageChannel," +  
77 - "geoCoordSys," +  
78 - "treeType," +  
79 - "online" + 71 + "subscribe_cycle_for_catalog," +
  72 + "subscribe_cycle_for_mobile_position,"+
  73 + "mobile_position_submission_interval,"+
  74 + "subscribe_cycle_for_alarm,"+
  75 + "ssrc_check,"+
  76 + "as_message_channel,"+
  77 + "geo_coord_sys,"+
  78 + "tree_type,"+
  79 + "online"+
80 ") VALUES (" + 80 ") VALUES (" +
81 "#{deviceId}," + 81 "#{deviceId}," +
82 "#{name}," + 82 "#{name}," +
@@ -110,167 +110,167 @@ public interface DeviceMapper { @@ -110,167 +110,167 @@ public interface DeviceMapper {
110 int add(Device device); 110 int add(Device device);
111 111
112 @Update(value = {" <script>" + 112 @Update(value = {" <script>" +
113 - "UPDATE device " +  
114 - "SET updateTime=#{updateTime}" + 113 + "UPDATE wvp_device " +
  114 + "SET update_time=#{updateTime}" +
115 "<if test=\"name != null\">, name=#{name}</if>" + 115 "<if test=\"name != null\">, name=#{name}</if>" +
116 "<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" + 116 "<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" +
117 "<if test=\"model != null\">, model=#{model}</if>" + 117 "<if test=\"model != null\">, model=#{model}</if>" +
118 "<if test=\"firmware != null\">, firmware=#{firmware}</if>" + 118 "<if test=\"firmware != null\">, firmware=#{firmware}</if>" +
119 "<if test=\"transport != null\">, transport=#{transport}</if>" + 119 "<if test=\"transport != null\">, transport=#{transport}</if>" +
120 "<if test=\"ip != null\">, ip=#{ip}</if>" + 120 "<if test=\"ip != null\">, ip=#{ip}</if>" +
121 - "<if test=\"localIp != null\">, localIp=#{localIp}</if>" + 121 + "<if test=\"localIp != null\">, local_ip=#{localIp}</if>" +
122 "<if test=\"port != null\">, port=#{port}</if>" + 122 "<if test=\"port != null\">, port=#{port}</if>" +
123 - "<if test=\"hostAddress != null\">, hostAddress=#{hostAddress}</if>" + 123 + "<if test=\"hostAddress != null\">, host_address=#{hostAddress}</if>" +
124 "<if test=\"online != null\">, online=#{online}</if>" + 124 "<if test=\"online != null\">, online=#{online}</if>" +
125 - "<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" +  
126 - "<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" +  
127 - "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" + 125 + "<if test=\"registerTime != null\">, register_time=#{registerTime}</if>" +
  126 + "<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" +
  127 + "<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" +
128 "<if test=\"expires != null\">, expires=#{expires}</if>" + 128 "<if test=\"expires != null\">, expires=#{expires}</if>" +
129 - "WHERE deviceId=#{deviceId}"+ 129 + "WHERE device_id=#{deviceId}"+
130 " </script>"}) 130 " </script>"})
131 int update(Device device); 131 int update(Device device);
132 132
133 @Select( 133 @Select(
134 " <script>" + 134 " <script>" +
135 "SELECT " + 135 "SELECT " +
136 - "deviceId, " + 136 + "device_id, " +
137 "coalesce(custom_name, name) as name, " + 137 "coalesce(custom_name, name) as name, " +
138 "password, " + 138 "password, " +
139 "manufacturer, " + 139 "manufacturer, " +
140 "model, " + 140 "model, " +
141 "firmware, " + 141 "firmware, " +
142 "transport," + 142 "transport," +
143 - "streamMode," +  
144 - "ip," +  
145 - "sdpIp," +  
146 - "localIp," +  
147 - "port," +  
148 - "hostAddress," +  
149 - "expires," +  
150 - "registerTime," +  
151 - "keepaliveTime," +  
152 - "createTime," +  
153 - "updateTime," +  
154 - "charset," +  
155 - "subscribeCycleForCatalog," +  
156 - "subscribeCycleForMobilePosition," +  
157 - "mobilePositionSubmissionInterval," +  
158 - "subscribeCycleForAlarm," +  
159 - "ssrcCheck," +  
160 - "asMessageChannel," +  
161 - "geoCoordSys," +  
162 - "treeType," +  
163 - "online," +  
164 - "mediaServerId," +  
165 - "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de" + 143 + "stream_mode," +
  144 + "ip,"+
  145 + "sdp_ip,"+
  146 + "local_ip,"+
  147 + "port,"+
  148 + "host_address,"+
  149 + "expires,"+
  150 + "register_time,"+
  151 + "keepalive_time,"+
  152 + "create_time,"+
  153 + "update_time,"+
  154 + "charset,"+
  155 + "subscribe_cycle_for_catalog,"+
  156 + "subscribe_cycle_for_mobile_position,"+
  157 + "mobile_position_submission_interval,"+
  158 + "subscribe_cycle_for_alarm,"+
  159 + "ssrc_check,"+
  160 + "as_message_channel,"+
  161 + "geo_coord_sys,"+
  162 + "tree_type,"+
  163 + "online,"+
  164 + "media_server_id,"+
  165 + "(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count FROM wvp_device de" +
166 "<if test=\"online != null\"> where online=${online}</if>"+ 166 "<if test=\"online != null\"> where online=${online}</if>"+
167 " </script>" 167 " </script>"
168 ) 168 )
169 List<Device> getDevices(Boolean online); 169 List<Device> getDevices(Boolean online);
170 170
171 - @Delete("DELETE FROM device WHERE deviceId=#{deviceId}") 171 + @Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}")
172 int del(String deviceId); 172 int del(String deviceId);
173 173
174 @Select("SELECT " + 174 @Select("SELECT " +
175 - "deviceId, " + 175 + "device_id, " +
176 "coalesce(custom_name, name) as name, " + 176 "coalesce(custom_name, name) as name, " +
177 "password, " + 177 "password, " +
178 "manufacturer, " + 178 "manufacturer, " +
179 "model, " + 179 "model, " +
180 "firmware, " + 180 "firmware, " +
181 "transport," + 181 "transport," +
182 - "streamMode," + 182 + "stream_mode," +
183 "ip," + 183 "ip," +
184 - "sdpIp," +  
185 - "localIp," +  
186 - "port," +  
187 - "hostAddress," +  
188 - "expires," +  
189 - "registerTime," +  
190 - "keepaliveTime," +  
191 - "createTime," +  
192 - "updateTime," +  
193 - "charset," +  
194 - "subscribeCycleForCatalog," +  
195 - "subscribeCycleForMobilePosition," +  
196 - "mobilePositionSubmissionInterval," +  
197 - "subscribeCycleForAlarm," +  
198 - "ssrcCheck," +  
199 - "asMessageChannel," +  
200 - "geoCoordSys," +  
201 - "treeType," +  
202 - "online " +  
203 - " FROM device WHERE online = 1") 184 + "sdp_ip,"+
  185 + "local_ip,"+
  186 + "port,"+
  187 + "host_address,"+
  188 + "expires,"+
  189 + "register_time,"+
  190 + "keepalive_time,"+
  191 + "create_time,"+
  192 + "update_time,"+
  193 + "charset,"+
  194 + "subscribe_cycle_for_catalog,"+
  195 + "subscribe_cycle_for_mobile_position,"+
  196 + "mobile_position_submission_interval,"+
  197 + "subscribe_cycle_for_alarm,"+
  198 + "ssrc_check,"+
  199 + "as_message_channel,"+
  200 + "geo_coord_sys,"+
  201 + "tree_type,"+
  202 + "online"+
  203 + " FROM wvp_device WHERE online = true")
204 List<Device> getOnlineDevices(); 204 List<Device> getOnlineDevices();
205 @Select("SELECT " + 205 @Select("SELECT " +
206 - "deviceId, " +  
207 - "coalesce(custom_name, name) as name, " +  
208 - "password, " +  
209 - "manufacturer, " +  
210 - "model, " +  
211 - "firmware, " +  
212 - "transport," +  
213 - "streamMode," +  
214 - "ip," +  
215 - "sdpIp," +  
216 - "localIp," +  
217 - "port," +  
218 - "hostAddress," +  
219 - "expires," +  
220 - "registerTime," +  
221 - "keepaliveTime," +  
222 - "createTime," +  
223 - "updateTime," +  
224 - "charset," +  
225 - "subscribeCycleForCatalog," +  
226 - "subscribeCycleForMobilePosition," +  
227 - "mobilePositionSubmissionInterval," +  
228 - "subscribeCycleForAlarm," +  
229 - "ssrcCheck," +  
230 - "asMessageChannel," +  
231 - "geoCoordSys," +  
232 - "treeType," +  
233 - "online" +  
234 - " FROM device WHERE ip = #{host} AND port=#{port}") 206 + "device_id,"+
  207 + "coalesce(custom_name,name)as name,"+
  208 + "password,"+
  209 + "manufacturer,"+
  210 + "model,"+
  211 + "firmware,"+
  212 + "transport,"+
  213 + "stream_mode,"+
  214 + "ip,"+
  215 + "sdp_ip,"+
  216 + "local_ip,"+
  217 + "port,"+
  218 + "host_address,"+
  219 + "expires,"+
  220 + "register_time,"+
  221 + "keepalive_time,"+
  222 + "create_time,"+
  223 + "update_time,"+
  224 + "charset,"+
  225 + "subscribe_cycle_for_catalog,"+
  226 + "subscribe_cycle_for_mobile_position,"+
  227 + "mobile_position_submission_interval,"+
  228 + "subscribe_cycle_for_alarm,"+
  229 + "ssrc_check,"+
  230 + "as_message_channel,"+
  231 + "geo_coord_sys,"+
  232 + "tree_type,"+
  233 + "online"+
  234 + " FROM wvp_device WHERE ip = #{host} AND port=#{port}")
235 Device getDeviceByHostAndPort(String host, int port); 235 Device getDeviceByHostAndPort(String host, int port);
236 236
237 @Update(value = {" <script>" + 237 @Update(value = {" <script>" +
238 - "UPDATE device " +  
239 - "SET updateTime=#{updateTime}" + 238 + "UPDATE wvp_device " +
  239 + "SET update_time=#{updateTime}" +
240 "<if test=\"name != null\">, custom_name=#{name}</if>" + 240 "<if test=\"name != null\">, custom_name=#{name}</if>" +
241 "<if test=\"password != null\">, password=#{password}</if>" + 241 "<if test=\"password != null\">, password=#{password}</if>" +
242 - "<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" + 242 + "<if test=\"streamMode != null\">, stream_mode=#{streamMode}</if>" +
243 "<if test=\"ip != null\">, ip=#{ip}</if>" + 243 "<if test=\"ip != null\">, ip=#{ip}</if>" +
244 - "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + 244 + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
245 "<if test=\"port != null\">, port=#{port}</if>" + 245 "<if test=\"port != null\">, port=#{port}</if>" +
246 "<if test=\"charset != null\">, charset=#{charset}</if>" + 246 "<if test=\"charset != null\">, charset=#{charset}</if>" +
247 - "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" +  
248 - "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=#{subscribeCycleForMobilePosition}</if>" +  
249 - "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" +  
250 - "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" +  
251 - "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" +  
252 - "<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" +  
253 - "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +  
254 - "<if test=\"treeType != null\">, treeType=#{treeType}</if>" +  
255 - "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +  
256 - "WHERE deviceId=#{deviceId}"+ 247 + "<if test=\"subscribeCycleForCatalog != null\">, subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}</if>" +
  248 + "<if test=\"subscribeCycleForMobilePosition != null\">, subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition}</if>" +
  249 + "<if test=\"mobilePositionSubmissionInterval != null\">, mobile_position_submission_interval=#{mobilePositionSubmissionInterval}</if>" +
  250 + "<if test=\"subscribeCycleForAlarm != null\">, subscribe_cycle_for_alarm=#{subscribeCycleForAlarm}</if>" +
  251 + "<if test=\"ssrcCheck != null\">, ssrc_check=#{ssrcCheck}</if>" +
  252 + "<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" +
  253 + "<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" +
  254 + "<if test=\"treeType != null\">, tree_type=#{treeType}</if>" +
  255 + "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
  256 + "WHERE device_id=#{deviceId}"+
257 " </script>"}) 257 " </script>"})
258 void updateCustom(Device device); 258 void updateCustom(Device device);
259 259
260 - @Insert("INSERT INTO device (" +  
261 - "deviceId, " +  
262 - "custom_name, " +  
263 - "password, " +  
264 - "sdpIp, " +  
265 - "createTime," +  
266 - "updateTime," +  
267 - "charset," +  
268 - "ssrcCheck," +  
269 - "asMessageChannel," +  
270 - "geoCoordSys," +  
271 - "treeType," +  
272 - "online," +  
273 - "mediaServerId" + 260 + @Insert("INSERT INTO wvp_device (" +
  261 + "device_id,"+
  262 + "custom_name,"+
  263 + "password,"+
  264 + "sdp_ip,"+
  265 + "create_time,"+
  266 + "update_time,"+
  267 + "charset,"+
  268 + "ssrc_check,"+
  269 + "as_message_channel,"+
  270 + "geo_coord_sys,"+
  271 + "tree_type,"+
  272 + "online,"+
  273 + "media_server_id"+
274 ") VALUES (" + 274 ") VALUES (" +
275 "#{deviceId}," + 275 "#{deviceId}," +
276 "#{name}," + 276 "#{name}," +
@@ -288,12 +288,12 @@ public interface DeviceMapper { @@ -288,12 +288,12 @@ public interface DeviceMapper {
288 ")") 288 ")")
289 void addCustomDevice(Device device); 289 void addCustomDevice(Device device);
290 290
291 - @Select("select count(1) as total, sum(online) as online from device") 291 + @Select("select count(1) as total, sum(online) as online FROM wvp_device")
292 ResourceBaceInfo getOverview(); 292 ResourceBaceInfo getOverview();
293 293
294 - @Select("select * from device") 294 + @Select("select * FROM wvp_device")
295 List<Device> getAll(); 295 List<Device> getAll();
296 296
297 - @Select("select * from device where asMessageChannel = 1") 297 + @Select("select * FROM wvp_device where as_message_channel = true")
298 List<Device> queryDeviceWithAsMessageChannel(); 298 List<Device> queryDeviceWithAsMessageChannel();
299 } 299 }
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
@@ -11,25 +11,25 @@ import java.util.List; @@ -11,25 +11,25 @@ import java.util.List;
11 @Mapper 11 @Mapper
12 public interface DeviceMobilePositionMapper { 12 public interface DeviceMobilePositionMapper {
13 13
14 - @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + 14 + @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)"+
15 "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})") 15 "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})")
16 int insertNewPosition(MobilePosition mobilePosition); 16 int insertNewPosition(MobilePosition mobilePosition);
17 17
18 @Select(value = {" <script>" + 18 @Select(value = {" <script>" +
19 - "SELECT * FROM device_mobile_position" +  
20 - " WHERE deviceId = #{deviceId}" +  
21 - "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" + 19 + "SELECT * FROM wvp_device_mobile_position" +
  20 + " WHERE device_id = #{deviceId}" +
  21 + "<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" +
22 "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" + 22 "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
23 "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" + 23 "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
24 " ORDER BY time ASC" + 24 " ORDER BY time ASC" +
25 " </script>"}) 25 " </script>"})
26 List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime); 26 List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime);
27 27
28 - @Select("SELECT * FROM device_mobile_position WHERE deviceId = #{deviceId}" + 28 + @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" +
29 " ORDER BY time DESC LIMIT 1") 29 " ORDER BY time DESC LIMIT 1")
30 MobilePosition queryLatestPositionByDevice(String deviceId); 30 MobilePosition queryLatestPositionByDevice(String deviceId);
31 31
32 - @Delete("DELETE FROM device_mobile_position WHERE deviceId = #{deviceId}") 32 + @Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
33 int clearMobilePositionsByDeviceId(String deviceId); 33 int clearMobilePositionsByDeviceId(String deviceId);
34 34
35 } 35 }
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -14,94 +14,94 @@ import java.util.List; @@ -14,94 +14,94 @@ import java.util.List;
14 @Repository 14 @Repository
15 public interface GbStreamMapper { 15 public interface GbStreamMapper {
16 16
17 - @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +  
18 - "longitude, latitude, streamType, mediaServerId, createTime) VALUES" + 17 + @Insert("REPLACE INTO wvp_gb_stream (app, stream, gb_id, name, " +
  18 + "longitude, latitude, stream_type,media_server_id,create_time) VALUES" +
19 "(#{app}, #{stream}, #{gbId}, #{name}, " + 19 "(#{app}, #{stream}, #{gbId}, #{name}, " +
20 "#{longitude}, #{latitude}, #{streamType}, " + 20 "#{longitude}, #{latitude}, #{streamType}, " +
21 "#{mediaServerId}, #{createTime})") 21 "#{mediaServerId}, #{createTime})")
22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") 22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
23 int add(GbStream gbStream); 23 int add(GbStream gbStream);
24 24
25 - @Update("UPDATE gb_stream " + 25 + @Update("UPDATE wvp_gb_stream " +
26 "SET app=#{app}," + 26 "SET app=#{app}," +
27 "stream=#{stream}," + 27 "stream=#{stream}," +
28 - "gbId=#{gbId}," + 28 + "gb_id=#{gbId}," +
29 "name=#{name}," + 29 "name=#{name}," +
30 - "streamType=#{streamType}," + 30 + "stream_type=#{streamType}," +
31 "longitude=#{longitude}, " + 31 "longitude=#{longitude}, " +
32 "latitude=#{latitude}," + 32 "latitude=#{latitude}," +
33 - "mediaServerId=#{mediaServerId}" + 33 + "media_server_id=#{mediaServerId}" +
34 "WHERE app=#{app} AND stream=#{stream}") 34 "WHERE app=#{app} AND stream=#{stream}")
35 int updateByAppAndStream(GbStream gbStream); 35 int updateByAppAndStream(GbStream gbStream);
36 36
37 - @Update("UPDATE gb_stream " + 37 + @Update("UPDATE wvp_gb_stream " +
38 "SET app=#{app}," + 38 "SET app=#{app}," +
39 "stream=#{stream}," + 39 "stream=#{stream}," +
40 - "gbId=#{gbId}," + 40 + "gb_id=#{gbId}," +
41 "name=#{name}," + 41 "name=#{name}," +
42 - "streamType=#{streamType}," + 42 + "stream_type=#{streamType}," +
43 "longitude=#{longitude}, " + 43 "longitude=#{longitude}, " +
44 "latitude=#{latitude}," + 44 "latitude=#{latitude}," +
45 - "mediaServerId=#{mediaServerId}" +  
46 - "WHERE gbStreamId=#{gbStreamId}") 45 + "media_server_id=#{mediaServerId}" +
  46 + "WHERE gb_stream_id=#{gbStreamId}")
47 int update(GbStream gbStream); 47 int update(GbStream gbStream);
48 48
49 - @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") 49 + @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
50 int del(String app, String stream); 50 int del(String app, String stream);
51 51
52 @Select("<script> "+ 52 @Select("<script> "+
53 - "SELECT gs.* FROM gb_stream gs " + 53 + "SELECT gs.* FROM wvp_gb_stream gs " +
54 "WHERE " + 54 "WHERE " +
55 "1=1 " + 55 "1=1 " +
56 - " <if test='catalogId != null'> AND gs.gbStreamId in" +  
57 - "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " +  
58 - " <if test='catalogId == null'> AND gs.gbStreamId not in" +  
59 - "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " +  
60 - " <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> " +  
61 - " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +  
62 - " order by gs.gbStreamId asc " + 56 + " <if test='catalogId != null'> AND gs.gb_stream_id in" +
  57 + "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId} and pgs.catalog_id=#{catalogId})</if> " +
  58 + " <if test='catalogId == null'> AND gs.gb_stream_id not in" +
  59 + "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId}) </if> " +
  60 + " <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> " +
  61 + " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" +
  62 + " order by gs.gb_stream_id asc " +
63 "</script>") 63 "</script>")
64 List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId); 64 List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId);
65 65
66 - @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") 66 + @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
67 GbStream selectOne(String app, String stream); 67 GbStream selectOne(String app, String stream);
68 68
69 - @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") 69 + @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}")
70 List<GbStream> selectByGBId(String gbId); 70 List<GbStream> selectByGBId(String gbId);
71 71
72 - @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +  
73 - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " +  
74 - "WHERE gs.gbId = #{gbId} AND pgs.platformId = #{platformId}") 72 + @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " +
  73 + "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " +
  74 + "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}")
75 GbStream queryStreamInPlatform(String platformId, String gbId); 75 GbStream queryStreamInPlatform(String platformId, String gbId);
76 76
77 @Select("<script> "+ 77 @Select("<script> "+
78 - "select gt.gbId as channelId, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parentId," +  
79 - " '1' as registerWay, pc.civilCode, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" +  
80 - " from gb_stream gt " + 78 + "select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parent_id," +
  79 + " '1' as register_way, pc.civil_code, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" +
  80 + " from wvp_gb_stream gt " +
81 " left join (" + 81 " left join (" +
82 " select " + 82 " select " +
83 " <if test='usPushingAsStatus != true'> sp.status as status, </if>" + 83 " <if test='usPushingAsStatus != true'> sp.status as status, </if>" +
84 - " <if test='usPushingAsStatus == true'> sp.pushIng as status, </if>" +  
85 - "sp.app, sp.stream from stream_push sp" + 84 + " <if test='usPushingAsStatus == true'> sp.push_ing as status, </if>" +
  85 + "sp.app, sp.stream from wvp_stream_push sp" +
86 " union all" + 86 " union all" +
87 - " select spxy.status, spxy.app, spxy.stream from stream_proxy spxy" + 87 + " select spxy.status, spxy.app, spxy.stream from wvp_stream_proxy spxy" +
88 " ) st on st.app = gt.app and st.stream = gt.stream" + 88 " ) st on st.app = gt.app and st.stream = gt.stream" +
89 - " left join platform_gb_stream pgs on gt.gbStreamId = pgs.gbStreamId" +  
90 - " left join platform_catalog pc on pgs.catalogId = pc.id and pgs.platformId = pc.platformId" +  
91 - " where pgs.platformId=#{platformId}" + 89 + " left join wvp_platform_gb_stream pgs on gt.gb_stream_id = pgs.gb_stream_id" +
  90 + " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" +
  91 + " where pgs.platform_id=#{platformId}" +
92 "</script>") 92 "</script>")
93 List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus); 93 List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus);
94 94
95 95
96 - @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " +  
97 - "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") 96 + @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " +
  97 + "ON gs.gb_stream_id = pgs.gb_stream_id WHERE pgs.gb_stream_id is NULL")
98 List<GbStream> queryStreamNotInPlatform(); 98 List<GbStream> queryStreamNotInPlatform();
99 99
100 - @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") 100 + @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}")
101 void deleteWithoutGBId(String type, String mediaServerId); 101 void deleteWithoutGBId(String type, String mediaServerId);
102 102
103 @Delete("<script> "+ 103 @Delete("<script> "+
104 - "DELETE FROM gb_stream where " + 104 + "DELETE FROM wvp_gb_stream where " +
105 "<foreach collection='streamProxyItemList' item='item' separator='or'>" + 105 "<foreach collection='streamProxyItemList' item='item' separator='or'>" +
106 "(app=#{item.app} and stream=#{item.stream}) " + 106 "(app=#{item.app} and stream=#{item.stream}) " +
107 "</foreach>" + 107 "</foreach>" +
@@ -109,7 +109,7 @@ public interface GbStreamMapper { @@ -109,7 +109,7 @@ public interface GbStreamMapper {
109 void batchDel(List<StreamProxyItem> streamProxyItemList); 109 void batchDel(List<StreamProxyItem> streamProxyItemList);
110 110
111 @Delete("<script> "+ 111 @Delete("<script> "+
112 - "DELETE FROM gb_stream where " + 112 + "DELETE FROM wvp_gb_stream where " +
113 "<foreach collection='gbStreams' item='item' separator='or'>" + 113 "<foreach collection='gbStreams' item='item' separator='or'>" +
114 "(app=#{item.app} and stream=#{item.stream}) " + 114 "(app=#{item.app} and stream=#{item.stream}) " +
115 "</foreach>" + 115 "</foreach>" +
@@ -117,9 +117,9 @@ public interface GbStreamMapper { @@ -117,9 +117,9 @@ public interface GbStreamMapper {
117 void batchDelForGbStream(List<GbStream> gbStreams); 117 void batchDelForGbStream(List<GbStream> gbStreams);
118 118
119 @Insert("<script> " + 119 @Insert("<script> " +
120 - "INSERT IGNORE into gb_stream " +  
121 - "(app, stream, gbId, name, " +  
122 - "longitude, latitude, streamType, mediaServerId, createTime)" + 120 + "INSERT IGNORE into wvp_gb_stream " +
  121 + "(app, stream, gb_id, name, " +
  122 + "longitude, latitude, stream_type,media_server_id,create_time)" +
123 "values " + 123 "values " +
124 "<foreach collection='subList' index='index' item='item' separator=','> " + 124 "<foreach collection='subList' index='index' item='item' separator=','> " +
125 "(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " + 125 "(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " +
@@ -133,40 +133,40 @@ public interface GbStreamMapper { @@ -133,40 +133,40 @@ public interface GbStreamMapper {
133 @Update({"<script>" + 133 @Update({"<script>" +
134 "<foreach collection='gpsMsgInfos' item='item' separator=';'>" + 134 "<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
135 " UPDATE" + 135 " UPDATE" +
136 - " gb_stream" + 136 + " wvp_gb_stream" +
137 " SET longitude=#{item.lng}, latitude=#{item.lat} " + 137 " SET longitude=#{item.lng}, latitude=#{item.lat} " +
138 - "WHERE gbId=#{item.id}"+ 138 + "WHERE gb_id=#{item.id}"+
139 "</foreach>" + 139 "</foreach>" +
140 "</script>"}) 140 "</script>"})
141 int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos); 141 int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
142 142
143 @Select("<script> "+ 143 @Select("<script> "+
144 - "SELECT * FROM gb_stream where " + 144 + "SELECT * FROM wvp_gb_stream where " +
145 "<foreach collection='streamPushItems' item='item' separator='or'>" + 145 "<foreach collection='streamPushItems' item='item' separator='or'>" +
146 "(app=#{item.app} and stream=#{item.stream}) " + 146 "(app=#{item.app} and stream=#{item.stream}) " +
147 "</foreach>" + 147 "</foreach>" +
148 "</script>") 148 "</script>")
149 List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems); 149 List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
150 150
151 - @Update("UPDATE gb_stream " +  
152 - "SET mediaServerId=#{mediaServerId}" + 151 + @Update("UPDATE wvp_gb_stream " +
  152 + "SET media_server_id=#{mediaServerId}" +
153 "WHERE app=#{app} AND stream=#{stream}") 153 "WHERE app=#{app} AND stream=#{stream}")
154 void updateMediaServer(String app, String stream, String mediaServerId); 154 void updateMediaServer(String app, String stream, String mediaServerId);
155 155
156 @Update("<script> "+ 156 @Update("<script> "+
157 " <foreach collection='list' item='item' index='index' separator=';'>"+ 157 " <foreach collection='list' item='item' index='index' separator=';'>"+
158 - "UPDATE gb_stream " + 158 + "UPDATE wvp_gb_stream " +
159 " SET name=#{item.name},"+ 159 " SET name=#{item.name},"+
160 - " gbId=#{item.gbId}"+ 160 + " gb_id=#{item.gb_id}"+
161 " WHERE app=#{item.app} and stream=#{item.stream}"+ 161 " WHERE app=#{item.app} and stream=#{item.stream}"+
162 "</foreach>"+ 162 "</foreach>"+
163 "</script>") 163 "</script>")
164 int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate); 164 int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
165 165
166 - @Select("SELECT status FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") 166 + @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
167 Boolean selectStatusForProxy(String app, String stream); 167 Boolean selectStatusForProxy(String app, String stream);
168 168
169 - @Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}") 169 + @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
170 Boolean selectStatusForPush(String app, String stream); 170 Boolean selectStatusForPush(String app, String stream);
171 171
172 } 172 }
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
1 package com.genersoft.iot.vmp.storager.dao; 1 package com.genersoft.iot.vmp.storager.dao;
2 2
3 -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;  
4 import com.genersoft.iot.vmp.storager.dao.dto.LogDto; 3 import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
5 import org.apache.ibatis.annotations.Delete; 4 import org.apache.ibatis.annotations.Delete;
6 import org.apache.ibatis.annotations.Insert; 5 import org.apache.ibatis.annotations.Insert;
@@ -17,21 +16,21 @@ import java.util.List; @@ -17,21 +16,21 @@ import java.util.List;
17 @Repository 16 @Repository
18 public interface LogMapper { 17 public interface LogMapper {
19 18
20 - @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " + 19 + @Insert("insert into wvp_log ( name,type,uri,address,result,timing,username,create_time) " +
21 "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})") 20 "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})")
22 int add(LogDto logDto); 21 int add(LogDto logDto);
23 22
24 @Select(value = {"<script>" + 23 @Select(value = {"<script>" +
25 - " SELECT * FROM log " + 24 + " SELECT * FROM wvp_log " +
26 " WHERE 1=1 " + 25 " WHERE 1=1 " +
27 " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " + 26 " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
28 " <if test=\"type != null\" > AND type = #{type}</if>" + 27 " <if test=\"type != null\" > AND type = #{type}</if>" +
29 - " <if test=\"startTime != null\" > AND createTime &gt;= #{startTime} </if>" +  
30 - " <if test=\"endTime != null\" > AND createTime &lt;= #{endTime} </if>" +  
31 - " ORDER BY createTime DESC " + 28 + " <if test=\"startTime != null\" > AND create_time &gt;= #{startTime} </if>" +
  29 + " <if test=\"endTime != null\" > AND create_time &lt;= #{endTime} </if>" +
  30 + " ORDER BY create_time DESC " +
32 " </script>"}) 31 " </script>"})
33 List<LogDto> query(String query, String type, String startTime, String endTime); 32 List<LogDto> query(String query, String type, String startTime, String endTime);
34 33
35 - @Delete("DELETE FROM log") 34 + @Delete("DELETE FROM wvp_log")
36 int clear(); 35 int clear();
37 } 36 }
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
@@ -11,28 +11,28 @@ import java.util.List; @@ -11,28 +11,28 @@ import java.util.List;
11 @Repository 11 @Repository
12 public interface MediaServerMapper { 12 public interface MediaServerMapper {
13 13
14 - @Insert("INSERT INTO media_server (" +  
15 - "id, " +  
16 - "ip, " +  
17 - "hookIp, " +  
18 - "sdpIp, " +  
19 - "streamIp, " +  
20 - "httpPort, " +  
21 - "httpSSlPort, " +  
22 - "rtmpPort, " +  
23 - "rtmpSSlPort, " +  
24 - "rtpProxyPort, " +  
25 - "rtspPort, " +  
26 - "rtspSSLPort, " +  
27 - "autoConfig, " +  
28 - "secret, " +  
29 - "rtpEnable, " +  
30 - "rtpPortRange, " +  
31 - "recordAssistPort, " +  
32 - "defaultServer, " +  
33 - "createTime, " +  
34 - "updateTime, " +  
35 - "hookAliveInterval" + 14 + @Insert("INSERT INTO wvp_media_server (" +
  15 + "id,"+
  16 + "ip,"+
  17 + "hook_ip,"+
  18 + "sdp_ip,"+
  19 + "stream_ip,"+
  20 + "http_port,"+
  21 + "http_ssl_port,"+
  22 + "rtmp_port,"+
  23 + "rtmp_ssl_port,"+
  24 + "rtp_proxy_port,"+
  25 + "rtsp_port,"+
  26 + "rtsp_ssl_port,"+
  27 + "auto_config,"+
  28 + "secret,"+
  29 + "rtp_enable,"+
  30 + "rtp_port_range,"+
  31 + "record_assist_port,"+
  32 + "default_server,"+
  33 + "create_time,"+
  34 + "update_time,"+
  35 + "hook_alive_interval"+
36 ") VALUES " + 36 ") VALUES " +
37 "(" + 37 "(" +
38 "#{id}, " + 38 "#{id}, " +
@@ -59,70 +59,70 @@ public interface MediaServerMapper { @@ -59,70 +59,70 @@ public interface MediaServerMapper {
59 int add(MediaServerItem mediaServerItem); 59 int add(MediaServerItem mediaServerItem);
60 60
61 @Update(value = {" <script>" + 61 @Update(value = {" <script>" +
62 - "UPDATE media_server " +  
63 - "SET updateTime=#{updateTime}" + 62 + "UPDATE wvp_media_server " +
  63 + "SET update_time=#{updateTime}" +
64 "<if test=\"ip != null\">, ip=#{ip}</if>" + 64 "<if test=\"ip != null\">, ip=#{ip}</if>" +
65 - "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +  
66 - "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +  
67 - "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +  
68 - "<if test=\"httpPort != null\">, httpPort=#{httpPort}</if>" +  
69 - "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +  
70 - "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +  
71 - "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +  
72 - "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +  
73 - "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +  
74 - "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +  
75 - "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +  
76 - "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +  
77 - "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + 65 + "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
  66 + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
  67 + "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
  68 + "<if test=\"httpPort != null\">, http_port=#{httpPort}</if>" +
  69 + "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
  70 + "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
  71 + "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
  72 + "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
  73 + "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
  74 + "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
  75 + "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
  76 + "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
  77 + "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
78 "<if test=\"secret != null\">, secret=#{secret}</if>" + 78 "<if test=\"secret != null\">, secret=#{secret}</if>" +
79 - "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +  
80 - "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" + 79 + "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
  80 + "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
81 "WHERE id=#{id}"+ 81 "WHERE id=#{id}"+
82 " </script>"}) 82 " </script>"})
83 int update(MediaServerItem mediaServerItem); 83 int update(MediaServerItem mediaServerItem);
84 84
85 @Update(value = {" <script>" + 85 @Update(value = {" <script>" +
86 - "UPDATE media_server " +  
87 - "SET updateTime=#{updateTime}" + 86 + "UPDATE wvp_media_server " +
  87 + "SET update_time=#{updateTime}" +
88 "<if test=\"id != null\">, id=#{id}</if>" + 88 "<if test=\"id != null\">, id=#{id}</if>" +
89 - "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +  
90 - "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +  
91 - "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +  
92 - "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +  
93 - "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +  
94 - "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +  
95 - "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +  
96 - "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +  
97 - "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +  
98 - "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +  
99 - "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +  
100 - "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + 89 + "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
  90 + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
  91 + "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
  92 + "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
  93 + "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
  94 + "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
  95 + "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
  96 + "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
  97 + "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
  98 + "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
  99 + "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
  100 + "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
101 "<if test=\"secret != null\">, secret=#{secret}</if>" + 101 "<if test=\"secret != null\">, secret=#{secret}</if>" +
102 - "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +  
103 - "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" +  
104 - "WHERE ip=#{ip} and httpPort=#{httpPort}"+ 102 + "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
  103 + "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
  104 + "WHERE ip=#{ip} and http_port=#{httpPort}"+
105 " </script>"}) 105 " </script>"})
106 int updateByHostAndPort(MediaServerItem mediaServerItem); 106 int updateByHostAndPort(MediaServerItem mediaServerItem);
107 107
108 - @Select("SELECT * FROM media_server WHERE id=#{id}") 108 + @Select("SELECT * FROM wvp_media_server WHERE id=#{id}")
109 MediaServerItem queryOne(String id); 109 MediaServerItem queryOne(String id);
110 110
111 - @Select("SELECT * FROM media_server") 111 + @Select("SELECT * FROM wvp_media_server")
112 List<MediaServerItem> queryAll(); 112 List<MediaServerItem> queryAll();
113 113
114 - @Delete("DELETE FROM media_server WHERE id=#{id}") 114 + @Delete("DELETE FROM wvp_media_server WHERE id=#{id}")
115 void delOne(String id); 115 void delOne(String id);
116 116
117 - @Select("DELETE FROM media_server WHERE ip=#{host} and httpPort=#{port}") 117 + @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
118 void delOneByIPAndPort(String host, int port); 118 void delOneByIPAndPort(String host, int port);
119 119
120 - @Delete("DELETE FROM media_server WHERE defaultServer=1") 120 + @Delete("DELETE FROM wvp_media_server WHERE default_server=true")
121 int delDefault(); 121 int delDefault();
122 122
123 - @Select("SELECT * FROM media_server WHERE ip=#{host} and httpPort=#{port}") 123 + @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
124 MediaServerItem queryOneByHostAndPort(String host, int port); 124 MediaServerItem queryOneByHostAndPort(String host, int port);
125 125
126 - @Select("SELECT * FROM media_server WHERE defaultServer=1") 126 + @Select("SELECT * FROM wvp_media_server WHERE default_server=true")
127 MediaServerItem queryDefault(); 127 MediaServerItem queryDefault();
128 } 128 }
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -14,88 +14,88 @@ import java.util.List; @@ -14,88 +14,88 @@ import java.util.List;
14 @Repository 14 @Repository
15 public interface ParentPlatformMapper { 15 public interface ParentPlatformMapper {
16 16
17 - @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +  
18 - " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " +  
19 - " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + 17 + @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
  18 + "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,"+
  19 + "status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time,tree_type) " +
20 " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + 20 " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
21 " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " + 21 " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " +
22 " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") 22 " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
23 int addParentPlatform(ParentPlatform parentPlatform); 23 int addParentPlatform(ParentPlatform parentPlatform);
24 24
25 - @Update("UPDATE parent_platform " + 25 + @Update("UPDATE wvp_platform " +
26 "SET enable=#{enable}, " + 26 "SET enable=#{enable}, " +
27 "name=#{name}," + 27 "name=#{name}," +
28 - "deviceGBId=#{deviceGBId}," +  
29 - "serverGBId=#{serverGBId}, " +  
30 - "serverGBDomain=#{serverGBDomain}, " +  
31 - "serverIP=#{serverIP}," +  
32 - "serverPort=#{serverPort}, " +  
33 - "deviceIp=#{deviceIp}, " +  
34 - "devicePort=#{devicePort}, " + 28 + "device_gb_id=#{deviceGBId}," +
  29 + "server_gb_id=#{serverGBId}, " +
  30 + "server_gb_domain=#{serverGBDomain}, " +
  31 + "server_ip=#{serverIP}," +
  32 + "server_port=#{serverPort}, " +
  33 + "device_ip=#{deviceIp}, " +
  34 + "device_port=#{devicePort}, " +
35 "username=#{username}, " + 35 "username=#{username}, " +
36 "password=#{password}, " + 36 "password=#{password}, " +
37 "expires=#{expires}, " + 37 "expires=#{expires}, " +
38 - "keepTimeout=#{keepTimeout}, " + 38 + "keep_timeout=#{keepTimeout}, " +
39 "transport=#{transport}, " + 39 "transport=#{transport}, " +
40 - "characterSet=#{characterSet}, " + 40 + "character_set=#{characterSet}, " +
41 "ptz=#{ptz}, " + 41 "ptz=#{ptz}, " +
42 "rtcp=#{rtcp}, " + 42 "rtcp=#{rtcp}, " +
43 - "asMessageChannel=#{asMessageChannel}, " + 43 + "as_message_channel=#{asMessageChannel}, " +
44 "status=#{status}, " + 44 "status=#{status}, " +
45 - "startOfflinePush=#{startOfflinePush}, " +  
46 - "catalogGroup=#{catalogGroup}, " +  
47 - "administrativeDivision=#{administrativeDivision}, " +  
48 - "createTime=#{createTime}, " +  
49 - "updateTime=#{updateTime}, " +  
50 - "treeType=#{treeType}, " +  
51 - "catalogId=#{catalogId} " + 45 + "start_offline_push=#{startOfflinePush}, " +
  46 + "catalog_group=#{catalogGroup}, " +
  47 + "administrative_division=#{administrativeDivision}, " +
  48 + "create_time=#{createTime}, " +
  49 + "update_time=#{updateTime}, " +
  50 + "tree_type=#{treeType}, " +
  51 + "catalog_id=#{catalogId} " +
52 "WHERE id=#{id}") 52 "WHERE id=#{id}")
53 int updateParentPlatform(ParentPlatform parentPlatform); 53 int updateParentPlatform(ParentPlatform parentPlatform);
54 54
55 - @Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}") 55 + @Delete("DELETE FROM wvp_platform WHERE server_gb_id=#{serverGBId}")
56 int delParentPlatform(ParentPlatform parentPlatform); 56 int delParentPlatform(ParentPlatform parentPlatform);
57 57
58 @Select("SELECT *, ((SELECT count(0)\n" + 58 @Select("SELECT *, ((SELECT count(0)\n" +
59 - " FROM platform_gb_channel pc\n" +  
60 - " WHERE pc.platformId = pp.serverGBId)\n" + 59 + " FROM wvp_platform_gb_channel pc\n" +
  60 + " WHERE pc.platform_id = pp.server_gb_id)\n" +
61 " +\n" + 61 " +\n" +
62 " (SELECT count(0)\n" + 62 " (SELECT count(0)\n" +
63 - " FROM platform_gb_stream pgs\n" +  
64 - " WHERE pgs.platformId = pp.serverGBId)\n" + 63 + " FROM wvp_platform_gb_stream pgs\n" +
  64 + " WHERE pgs.platform_id = pp.server_gb_id)\n" +
65 " +\n" + 65 " +\n" +
66 " (SELECT count(0)\n" + 66 " (SELECT count(0)\n" +
67 - " FROM platform_catalog pgc\n" +  
68 - " WHERE pgc.platformId = pp.serverGBId)) as channelCount\n" +  
69 - "FROM parent_platform pp ") 67 + " FROM wvp_platform_catalog pgc\n" +
  68 + " WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" +
  69 + "FROM wvp_platform pp ")
70 List<ParentPlatform> getParentPlatformList(); 70 List<ParentPlatform> getParentPlatformList();
71 71
72 - @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") 72 + @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
73 List<ParentPlatform> getEnableParentPlatformList(boolean enable); 73 List<ParentPlatform> getEnableParentPlatformList(boolean enable);
74 74
75 - @Select("SELECT * FROM parent_platform WHERE enable=1 and asMessageChannel = 1") 75 + @Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
76 List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); 76 List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
77 77
78 - @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") 78 + @Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}")
79 ParentPlatform getParentPlatByServerGBId(String platformGbId); 79 ParentPlatform getParentPlatByServerGBId(String platformGbId);
80 80
81 - @Select("SELECT * FROM parent_platform WHERE id=#{id}") 81 + @Select("SELECT * FROM wvp_platform WHERE id=#{id}")
82 ParentPlatform getParentPlatById(int id); 82 ParentPlatform getParentPlatById(int id);
83 83
84 - @Update("UPDATE parent_platform SET status=false" ) 84 + @Update("UPDATE wvp_platform SET status=false" )
85 int outlineForAllParentPlatform(); 85 int outlineForAllParentPlatform();
86 86
87 - @Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" ) 87 + @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" )
88 int updateParentPlatformStatus(String platformGbID, boolean online); 88 int updateParentPlatformStatus(String platformGbID, boolean online);
89 89
90 @Update(value = {" <script>" + 90 @Update(value = {" <script>" +
91 - "UPDATE parent_platform " +  
92 - "SET catalogId=#{catalogId}, updateTime=#{updateTime}" +  
93 - "WHERE serverGBId=#{platformId}"+ 91 + "UPDATE wvp_platform " +
  92 + "SET catalog_id=#{catalogId}, update_time=#{updateTime}" +
  93 + "WHERE server_gb_id=#{platformId}"+
94 "</script>"}) 94 "</script>"})
95 int setDefaultCatalog(String platformId, String catalogId, String updateTime); 95 int setDefaultCatalog(String platformId, String catalogId, String updateTime);
96 96
97 - @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} " + 97 + @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} " +
98 "union " + 98 "union " +
99 - "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}")  
100 - List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); 99 + "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}")
  100 + List<ChannelSourceInfo> getChannelSource(String platform_id, String gbId);
101 } 101 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
1 package com.genersoft.iot.vmp.storager.dao; 1 package com.genersoft.iot.vmp.storager.dao;
2 2
3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 -import com.genersoft.iot.vmp.gb28181.bean.GbStream;  
5 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; 4 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
6 -import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;  
7 -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;  
8 import org.apache.ibatis.annotations.*; 5 import org.apache.ibatis.annotations.*;
9 import org.springframework.stereotype.Repository; 6 import org.springframework.stereotype.Repository;
10 7
@@ -15,22 +12,22 @@ import java.util.List; @@ -15,22 +12,22 @@ import java.util.List;
15 @Repository 12 @Repository
16 public interface PlatformCatalogMapper { 13 public interface PlatformCatalogMapper {
17 14
18 - @Insert("INSERT INTO platform_catalog (id, name, platformId, parentId, civilCode, businessGroupId) VALUES" + 15 + @Insert("INSERT INTO platform_catalog (id, name, platform_id, parent_id, civil_code, business_group_id) VALUES" +
19 "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})") 16 "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})")
20 int add(PlatformCatalog platformCatalog); 17 int add(PlatformCatalog platformCatalog);
21 18
22 - @Delete("DELETE FROM platform_catalog WHERE id=#{id}") 19 + @Delete("DELETE from wvp_platform_catalog WHERE id=#{id}")
23 int del(String id); 20 int del(String id);
24 21
25 - @Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") 22 + @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
26 int delByPlatformId(String platformId); 23 int delByPlatformId(String platformId);
27 24
28 - @Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " +  
29 - "left join platform_catalog pc2 on pc.id = pc2.parentId " +  
30 - "WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id") 25 + @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
  26 + "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " +
  27 + "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} group by pc.id")
31 List<PlatformCatalog> selectByParentId(String platformId, String parentId); 28 List<PlatformCatalog> selectByParentId(String platformId, String parentId);
32 29
33 - @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") 30 + @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}")
34 PlatformCatalog select(String id); 31 PlatformCatalog select(String id);
35 32
36 @Update(value = {" <script>" + 33 @Update(value = {" <script>" +
@@ -40,17 +37,17 @@ public interface PlatformCatalogMapper { @@ -40,17 +37,17 @@ public interface PlatformCatalogMapper {
40 "</script>"}) 37 "</script>"})
41 int update(PlatformCatalog platformCatalog); 38 int update(PlatformCatalog platformCatalog);
42 39
43 - @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.platformId=#{platformId}") 40 + @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}")
44 List<PlatformCatalog> selectByPlatForm(String platformId); 41 List<PlatformCatalog> selectByPlatForm(String platformId);
45 42
46 - @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalogId from parent_platform pp WHERE pp.serverGBId=#{platformId})") 43 + @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})")
47 PlatformCatalog selectDefaultByPlatFormId(String platformId); 44 PlatformCatalog selectDefaultByPlatFormId(String platformId);
48 45
49 46
50 @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}") 47 @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}")
51 PlatformCatalog selectParentCatalog(String id); 48 PlatformCatalog selectParentCatalog(String id);
52 49
53 - @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'1' as parental, pc.parentId " +  
54 - " FROM platform_catalog pc WHERE pc.platformId=#{platformId}") 50 + @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " +
  51 + " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
55 List<DeviceChannel> queryCatalogInPlatform(String platformId); 52 List<DeviceChannel> queryCatalogInPlatform(String platformId);
56 } 53 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -21,13 +21,13 @@ public interface PlatformChannelMapper { @@ -21,13 +21,13 @@ public interface PlatformChannelMapper {
21 * 查询列表里已经关联的 21 * 查询列表里已经关联的
22 */ 22 */
23 @Select("<script> "+ 23 @Select("<script> "+
24 - "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + 24 + "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
25 "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + 25 "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
26 "</script>") 26 "</script>")
27 List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); 27 List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
28 28
29 @Insert("<script> "+ 29 @Insert("<script> "+
30 - "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" + 30 + "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" +
31 "<foreach collection='channelReducesToAdd' item='item' separator=','>" + 31 "<foreach collection='channelReducesToAdd' item='item' separator=','>" +
32 " (#{platformId}, #{item.id} , #{item.catalogId} )" + 32 " (#{platformId}, #{item.id} , #{item.catalogId} )" +
33 "</foreach>" + 33 "</foreach>" +
@@ -35,50 +35,50 @@ public interface PlatformChannelMapper { @@ -35,50 +35,50 @@ public interface PlatformChannelMapper {
35 int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); 35 int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
36 36
37 @Delete("<script> "+ 37 @Delete("<script> "+
38 - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + 38 + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
39 "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + 39 "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
40 "</script>") 40 "</script>")
41 int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); 41 int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
42 42
43 @Delete("<script> "+ 43 @Delete("<script> "+
44 - "DELETE FROM platform_gb_channel WHERE deviceChannelId in " +  
45 - "( select temp.deviceChannelId from " +  
46 - "(select pgc.deviceChannelId from platform_gb_channel pgc " +  
47 - "left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " + 44 + "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " +
  45 + "( select temp.device_channel_id from " +
  46 + "(select pgc.device_channel_id from wvp_platform_gb_channel pgc " +
  47 + "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " +
48 ") temp)" + 48 ") temp)" +
49 "</script>") 49 "</script>")
50 int delChannelForDeviceId(String deviceId); 50 int delChannelForDeviceId(String deviceId);
51 51
52 @Delete("<script> "+ 52 @Delete("<script> "+
53 - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" + 53 + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" +
54 "</script>") 54 "</script>")
55 int cleanChannelForGB(String platformId); 55 int cleanChannelForGB(String platformId);
56 56
57 - @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}") 57 + @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}")
58 List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); 58 List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
59 59
60 - @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}") 60 + @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}")
61 List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); 61 List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
62 62
63 - @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +  
64 - " from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " +  
65 - " where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") 63 + @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 " +
  64 + " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " +
  65 + " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
66 List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); 66 List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
67 67
68 @Select("select d.*\n" + 68 @Select("select d.*\n" +
69 - "from platform_gb_channel pgc\n" +  
70 - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" +  
71 - " left join device d on dc.deviceId = d.deviceId\n" +  
72 - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") 69 + "from wvp_platform_gb_channel pgc\n" +
  70 + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
  71 + " left join wvp_device d on dc.device_id = d.device_id\n" +
  72 + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
73 List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); 73 List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
74 74
75 @Delete("<script> "+ 75 @Delete("<script> "+
76 - "DELETE FROM platform_gb_channel WHERE catalogId=#{id}" + 76 + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" +
77 "</script>") 77 "</script>")
78 int delByCatalogId(String id); 78 int delByCatalogId(String id);
79 79
80 @Delete("<script> "+ 80 @Delete("<script> "+
81 - "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + 81 + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
82 "</script>") 82 "</script>")
83 int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); 83 int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
84 84
@@ -86,35 +86,35 @@ public interface PlatformChannelMapper { @@ -86,35 +86,35 @@ public interface PlatformChannelMapper {
86 "SELECT " + 86 "SELECT " +
87 "pp.* " + 87 "pp.* " +
88 "FROM " + 88 "FROM " +
89 - "parent_platform pp " +  
90 - "left join platform_gb_channel pgc on " +  
91 - "pp.serverGBId = pgc.platformId " +  
92 - "left join device_channel dc on " +  
93 - "dc.id = pgc.deviceChannelId " + 89 + "wvp_platform pp " +
  90 + "left join wvp_platform_gb_channel pgc on " +
  91 + "pp.server_gb_id = pgc.platform_id " +
  92 + "left join wvp_device_channel dc on " +
  93 + "dc.id = pgc.device_channel_id " +
94 "WHERE " + 94 "WHERE " +
95 - "dc.channelId = #{channelId} and pp.status = true " +  
96 - "AND pp.serverGBId IN" +  
97 - "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + 95 + "dc.channel_id = #{channelId} and pp.status = true " +
  96 + "AND pp.server_gb_id IN" +
  97 + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
98 "</script> ") 98 "</script> ")
99 List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); 99 List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
100 100
101 @Delete("<script> " + 101 @Delete("<script> " +
102 - "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" + 102 + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" +
103 "</script>") 103 "</script>")
104 void delByPlatformId(String serverGBId); 104 void delByPlatformId(String serverGBId);
105 105
106 @Delete("<script> " + 106 @Delete("<script> " +
107 - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" + 107 + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" +
108 "</script>") 108 "</script>")
109 int delChannelForGBByCatalogId(String platformId, String catalogId); 109 int delChannelForGBByCatalogId(String platformId, String catalogId);
110 110
111 - @Select("select dc.channelId deviceId,dc.name,d.manufacturer,d.model,d.firmware\n" +  
112 - "from platform_gb_channel pgc\n" +  
113 - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" +  
114 - " left join device d on dc.deviceId = d.deviceId\n" +  
115 - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") 111 + @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
  112 + "from wvp_platform_gb_channel pgc\n" +
  113 + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
  114 + " left join wvp_device d on dc.device_id = d.device_id\n" +
  115 + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
116 List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId); 116 List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId);
117 117
118 - @Select("SELECT pgc.platformId FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}'") 118 + @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}'")
119 List<String> queryParentPlatformByChannelId(String channelId); 119 List<String> queryParentPlatformByChannelId(String channelId);
120 } 120 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -16,82 +16,82 @@ import java.util.List; @@ -16,82 +16,82 @@ import java.util.List;
16 @Repository 16 @Repository
17 public interface PlatformGbStreamMapper { 17 public interface PlatformGbStreamMapper {
18 18
19 - @Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" + 19 + @Insert("REPLACE INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" +
20 "( #{gbStreamId}, #{platformId}, #{catalogId})") 20 "( #{gbStreamId}, #{platformId}, #{catalogId})")
21 int add(PlatformGbStream platformGbStream); 21 int add(PlatformGbStream platformGbStream);
22 22
23 23
24 @Insert("<script> " + 24 @Insert("<script> " +
25 - "INSERT into platform_gb_stream " +  
26 - "(gbStreamId, platformId, catalogId) " + 25 + "INSERT into wvp_platform_gb_stream " +
  26 + "(gb_stream_id, platform_id, catalog_id) " +
27 "values " + 27 "values " +
28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + 28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
29 - "(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" + 29 + "(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" +
30 "</foreach> " + 30 "</foreach> " +
31 "</script>") 31 "</script>")
32 int batchAdd(List<StreamPushItem> streamPushItems); 32 int batchAdd(List<StreamPushItem> streamPushItems);
33 33
34 - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbStreamId from gb_stream where app=#{app} AND stream=#{stream})") 34 + @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})")
35 int delByAppAndStream(String app, String stream); 35 int delByAppAndStream(String app, String stream);
36 36
37 - @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") 37 + @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}")
38 int delByPlatformId(String platformId); 38 int delByPlatformId(String platformId);
39 39
40 @Select("SELECT " + 40 @Select("SELECT " +
41 "pp.* " + 41 "pp.* " +
42 "FROM " + 42 "FROM " +
43 - "platform_gb_stream pgs " +  
44 - "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +  
45 - "LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " + 43 + "wvp_platform_gb_stream pgs " +
  44 + "LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " +
  45 + "LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " +
46 "WHERE " + 46 "WHERE " +
47 "gs.app =#{app} " + 47 "gs.app =#{app} " +
48 "AND gs.stream =#{stream} ") 48 "AND gs.stream =#{stream} ")
49 List<ParentPlatform> selectByAppAndStream(String app, String stream); 49 List<ParentPlatform> selectByAppAndStream(String app, String stream);
50 50
51 - @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " +  
52 - "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId " +  
53 - "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}") 51 + @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " +
  52 + "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " +
  53 + "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{serverGBId}")
54 StreamProxyItem selectOne(String app, String stream, String serverGBId); 54 StreamProxyItem selectOne(String app, String stream, String serverGBId);
55 55
56 @Select("select gs.* \n" + 56 @Select("select gs.* \n" +
57 - "from gb_stream gs\n" +  
58 - " left join platform_gb_stream pgs\n" +  
59 - " on gs.gbStreamId = pgs.gbStreamId\n" +  
60 - "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") 57 + "from wvp_gb_stream gs\n" +
  58 + " left join wvp_platform_gb_stream pgs\n" +
  59 + " on gs.gb_stream_id = pgs.gb_stream_id\n" +
  60 + "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
61 List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); 61 List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
62 62
63 - @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" +  
64 - "from gb_stream gs\n" +  
65 - " left join platform_gb_stream pgs\n" +  
66 - " on gs.gbStreamId = pgs.gbStreamId\n" +  
67 - "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") 63 + @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" +
  64 + "from wvp_gb_stream gs\n" +
  65 + " left join wvp_platform_gb_stream pgs\n" +
  66 + " on gs.gb_stream_id = pgs.gb_stream_id\n" +
  67 + "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
68 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); 68 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
69 69
70 - @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") 70 + @Delete("DELETE from wvp_platform_gb_stream WHERE catalog_id=#{id}")
71 int delByCatalogId(String id); 71 int delByCatalogId(String id);
72 72
73 @Select("<script> " + 73 @Select("<script> " +
74 "SELECT " + 74 "SELECT " +
75 "pp.* " + 75 "pp.* " +
76 "FROM " + 76 "FROM " +
77 - "parent_platform pp " +  
78 - "left join platform_gb_stream pgs on " +  
79 - "pp.serverGBId = pgs.platformId " +  
80 - "left join gb_stream gs " +  
81 - "on gs.gbStreamId = pgs.gbStreamId " + 77 + "wvp_platform pp " +
  78 + "left join wvp_platform_gb_stream pgs on " +
  79 + "pp.server_gb_id = pgs.platform_id " +
  80 + "left join wvp_gb_stream gs " +
  81 + "on gs.gb_stream_id = pgs.gb_stream_id " +
82 "WHERE " + 82 "WHERE " +
83 "gs.app = #{app} " + 83 "gs.app = #{app} " +
84 "AND gs.stream = #{stream}" + 84 "AND gs.stream = #{stream}" +
85 - "AND pp.serverGBId IN" + 85 + "AND pp.server_gb_id IN" +
86 "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + 86 "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
87 "</script> ") 87 "</script> ")
88 List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); 88 List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms);
89 89
90 - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select id from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}") 90 + @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}")
91 int delByAppAndStreamAndPlatform(String app, String stream, String platformId); 91 int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
92 92
93 @Delete("<script> "+ 93 @Delete("<script> "+
94 - "DELETE FROM platform_gb_stream where gbStreamId in " + 94 + "DELETE from wvp_platform_gb_stream where gb_stream_id in " +
95 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" + 95 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" +
96 "#{item.gbStreamId}" + 96 "#{item.gbStreamId}" +
97 "</foreach>" + 97 "</foreach>" +
@@ -99,13 +99,13 @@ public interface PlatformGbStreamMapper { @@ -99,13 +99,13 @@ public interface PlatformGbStreamMapper {
99 void delByGbStreams(List<GbStream> gbStreams); 99 void delByGbStreams(List<GbStream> gbStreams);
100 100
101 @Delete("<script> "+ 101 @Delete("<script> "+
102 - "DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " + 102 + "DELETE from wvp_platform_gb_stream where platform_id=#{platformId} and gb_stream_id in " +
103 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" + 103 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" +
104 "#{item.gbStreamId} " + 104 "#{item.gbStreamId} " +
105 "</foreach>" + 105 "</foreach>" +
106 "</script>") 106 "</script>")
107 void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId); 107 void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
108 108
109 - @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}") 109 + @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}")
110 int delByPlatformAndCatalogId(String platformId, String catalogId); 110 int delByPlatformAndCatalogId(String platformId, String catalogId);
111 } 111 }
src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java deleted 100644 → 0
1 -package com.genersoft.iot.vmp.storager.dao;  
2 -  
3 -import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;  
4 -import org.apache.ibatis.annotations.Delete;  
5 -import org.apache.ibatis.annotations.Insert;  
6 -import org.apache.ibatis.annotations.Mapper;  
7 -import org.apache.ibatis.annotations.Select;  
8 -import org.springframework.stereotype.Repository;  
9 -  
10 -import java.util.List;  
11 -  
12 -@Mapper  
13 -@Repository  
14 -public interface RecordInfoDao {  
15 -  
16 - @Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" +  
17 - "(#{app}, #{stream}, #{mediaServerId}, datetime('now','localtime')), #{type}, #{deviceId}, #{channelId}, #{name}")  
18 - int add(RecordInfo recordInfo);  
19 -  
20 - @Delete("DELETE FROM user WHERE createTime < #{beforeTime}")  
21 - int deleteBefore(String beforeTime);  
22 -  
23 - @Select("select * FROM recordInfo")  
24 - List<RecordInfo> selectAll();  
25 -}  
src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
1 package com.genersoft.iot.vmp.storager.dao; 1 package com.genersoft.iot.vmp.storager.dao;
2 2
3 import com.genersoft.iot.vmp.storager.dao.dto.Role; 3 import com.genersoft.iot.vmp.storager.dao.dto.Role;
4 -import com.genersoft.iot.vmp.storager.dao.dto.User;  
5 import org.apache.ibatis.annotations.*; 4 import org.apache.ibatis.annotations.*;
6 import org.springframework.stereotype.Repository; 5 import org.springframework.stereotype.Repository;
7 6
@@ -11,25 +10,25 @@ import java.util.List; @@ -11,25 +10,25 @@ import java.util.List;
11 @Repository 10 @Repository
12 public interface RoleMapper { 11 public interface RoleMapper {
13 12
14 - @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + 13 + @Insert("INSERT INTO wvp_user_role (name, authority, create_time, update_time) VALUES" +
15 "(#{name}, #{authority}, #{createTime}, #{updateTime})") 14 "(#{name}, #{authority}, #{createTime}, #{updateTime})")
16 int add(Role role); 15 int add(Role role);
17 16
18 @Update(value = {" <script>" + 17 @Update(value = {" <script>" +
19 - "UPDATE user_role " +  
20 - "SET updateTime=#{updateTime} " + 18 + "UPDATE wvp_user_role " +
  19 + "SET update_time=#{updateTime} " +
21 "<if test=\"name != null\">, name=#{name}</if>" + 20 "<if test=\"name != null\">, name=#{name}</if>" +
22 "<if test=\"authority != null\">, authority=#{authority}</if>" + 21 "<if test=\"authority != null\">, authority=#{authority}</if>" +
23 "WHERE id != 1 and id=#{id}" + 22 "WHERE id != 1 and id=#{id}" +
24 " </script>"}) 23 " </script>"})
25 int update(Role role); 24 int update(Role role);
26 25
27 - @Delete("DELETE FROM user_role WHERE id != 1 and id=#{id}") 26 + @Delete("DELETE from wvp_user_role WHERE id != 1 and id=#{id}")
28 int delete(int id); 27 int delete(int id);
29 28
30 - @Select("select * FROM user_role WHERE id=#{id}") 29 + @Select("select * from wvp_user_role WHERE id=#{id}")
31 Role selectById(int id); 30 Role selectById(int id);
32 31
33 - @Select("select * FROM user_role") 32 + @Select("select * from wvp_user_role")
34 List<Role> selectAll(); 33 List<Role> selectAll();
35 } 34 }
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
@@ -11,20 +11,20 @@ import java.util.List; @@ -11,20 +11,20 @@ import java.util.List;
11 @Repository 11 @Repository
12 public interface StreamProxyMapper { 12 public interface StreamProxyMapper {
13 13
14 - @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " +  
15 - "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" + 14 + @Insert("INSERT INTO wvp_stream_proxy (type, name, app, stream,media_server_id, url, src_url, dst_url, " +
  15 + "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" +
16 "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " + 16 "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " +
17 "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " + 17 "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " +
18 "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )") 18 "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )")
19 int add(StreamProxyItem streamProxyDto); 19 int add(StreamProxyItem streamProxyDto);
20 20
21 - @Update("UPDATE stream_proxy " + 21 + @Update("UPDATE wvp_stream_proxy " +
22 "SET type=#{type}, " + 22 "SET type=#{type}, " +
23 "name=#{name}," + 23 "name=#{name}," +
24 "app=#{app}," + 24 "app=#{app}," +
25 "stream=#{stream}," + 25 "stream=#{stream}," +
26 "url=#{url}, " + 26 "url=#{url}, " +
27 - "mediaServerId=#{mediaServerId}, " + 27 + "media_server_id=#{mediaServerId}, " +
28 "src_url=#{src_url}," + 28 "src_url=#{src_url}," +
29 "dst_url=#{dst_url}, " + 29 "dst_url=#{dst_url}, " +
30 "timeout_ms=#{timeout_ms}, " + 30 "timeout_ms=#{timeout_ms}, " +
@@ -39,44 +39,44 @@ public interface StreamProxyMapper { @@ -39,44 +39,44 @@ public interface StreamProxyMapper {
39 "WHERE app=#{app} AND stream=#{stream}") 39 "WHERE app=#{app} AND stream=#{stream}")
40 int update(StreamProxyItem streamProxyDto); 40 int update(StreamProxyItem streamProxyDto);
41 41
42 - @Delete("DELETE FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") 42 + @Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
43 int del(String app, String stream); 43 int del(String app, String stream);
44 44
45 - @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") 45 + @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")
46 List<StreamProxyItem> selectAll(); 46 List<StreamProxyItem> selectAll();
47 47
48 - @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") 48 + @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")
49 List<StreamProxyItem> selectForEnable(boolean enable); 49 List<StreamProxyItem> selectForEnable(boolean enable);
50 50
51 - @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") 51 + @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")
52 StreamProxyItem selectOne(String app, String stream); 52 StreamProxyItem selectOne(String app, String stream);
53 53
54 - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " +  
55 - "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +  
56 - "WHERE st.enable=#{enable} and st.mediaServerId = #{id} order by st.createTime desc") 54 + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
  55 + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
  56 + "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc")
57 List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable); 57 List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable);
58 58
59 - @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " +  
60 - "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +  
61 - "WHERE st.mediaServerId = #{id} order by st.createTime desc") 59 + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
  60 + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
  61 + "WHERE st.media_server_id= #{id} order by st.create_time desc")
62 List<StreamProxyItem> selectInMediaServer(String id); 62 List<StreamProxyItem> selectInMediaServer(String id);
63 63
64 - @Update("UPDATE stream_proxy " + 64 + @Update("UPDATE wvp_stream_proxy " +
65 "SET status=#{status} " + 65 "SET status=#{status} " +
66 - "WHERE mediaServerId=#{mediaServerId}") 66 + "WHERE media_server_id=#{mediaServerId}")
67 void updateStatusByMediaServerId(String mediaServerId, boolean status); 67 void updateStatusByMediaServerId(String mediaServerId, boolean status);
68 68
69 - @Update("UPDATE stream_proxy " + 69 + @Update("UPDATE wvp_stream_proxy " +
70 "SET status=#{status} " + 70 "SET status=#{status} " +
71 "WHERE app=#{app} AND stream=#{stream}") 71 "WHERE app=#{app} AND stream=#{stream}")
72 int updateStatus(String app, String stream, boolean status); 72 int updateStatus(String app, String stream, boolean status);
73 73
74 - @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") 74 + @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}")
75 void deleteAutoRemoveItemByMediaServerId(String mediaServerId); 75 void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
76 76
77 - @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")  
78 - List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId); 77 + @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")
  78 + List<StreamProxyItem> selectAutoRemoveItemByMediaServerId(String mediaServerId);
79 79
80 - @Select("select count(1) as total, sum(status) as online from stream_proxy") 80 + @Select("select count(1) as total, sum(status) as online from wvp_stream_proxy")
81 ResourceBaceInfo getOverview(); 81 ResourceBaceInfo getOverview();
82 } 82 }
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -5,18 +5,16 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; @@ -5,18 +5,16 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
5 import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; 5 import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
6 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; 6 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
7 import org.apache.ibatis.annotations.*; 7 import org.apache.ibatis.annotations.*;
8 -// import org.omg.PortableInterceptor.INACTIVE;  
9 import org.springframework.stereotype.Repository; 8 import org.springframework.stereotype.Repository;
10 9
11 -import java.util.Collection;  
12 import java.util.List; 10 import java.util.List;
13 11
14 @Mapper 12 @Mapper
15 @Repository 13 @Repository
16 public interface StreamPushMapper { 14 public interface StreamPushMapper {
17 15
18 - @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +  
19 - "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + 16 + @Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
  17 + "push_time, alive_second, media_server_id, server_id, update_time, create_time, push_ing, self) VALUES" +
20 "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " + 18 "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " +
21 "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " + 19 "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " +
22 "#{pushIng}, #{self} )") 20 "#{pushIng}, #{self} )")
@@ -24,33 +22,33 @@ public interface StreamPushMapper { @@ -24,33 +22,33 @@ public interface StreamPushMapper {
24 22
25 23
26 @Update(value = {" <script>" + 24 @Update(value = {" <script>" +
27 - "UPDATE stream_push " +  
28 - "SET updateTime=#{updateTime}" +  
29 - "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +  
30 - "<if test=\"totalReaderCount != null\">, totalReaderCount=#{totalReaderCount}</if>" +  
31 - "<if test=\"originType != null\">, originType=#{originType}</if>" +  
32 - "<if test=\"originTypeStr != null\">, originTypeStr=#{originTypeStr}</if>" +  
33 - "<if test=\"pushTime != null\">, pushTime=#{pushTime}</if>" +  
34 - "<if test=\"aliveSecond != null\">, aliveSecond=#{aliveSecond}</if>" +  
35 - "<if test=\"pushIng != null\">, pushIng=#{pushIng}</if>" + 25 + "UPDATE wvp_stream_push " +
  26 + "SET update_time=#{updateTime}" +
  27 + "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
  28 + "<if test=\"totalReaderCount != null\">, total_reader_count=#{totalReaderCount}</if>" +
  29 + "<if test=\"originType != null\">, origin_type=#{originType}</if>" +
  30 + "<if test=\"originTypeStr != null\">, origin_type_str=#{originTypeStr}</if>" +
  31 + "<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" +
  32 + "<if test=\"aliveSecond != null\">, alive_second=#{aliveSecond}</if>" +
  33 + "<if test=\"pushIng != null\">, push_ing=#{pushIng}</if>" +
36 "<if test=\"self != null\">, self=#{self}</if>" + 34 "<if test=\"self != null\">, self=#{self}</if>" +
37 "WHERE app=#{app} AND stream=#{stream}"+ 35 "WHERE app=#{app} AND stream=#{stream}"+
38 " </script>"}) 36 " </script>"})
39 int update(StreamPushItem streamPushItem); 37 int update(StreamPushItem streamPushItem);
40 38
41 - @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") 39 + @Delete("DELETE FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
42 int del(String app, String stream); 40 int del(String app, String stream);
43 41
44 @Delete("<script> "+ 42 @Delete("<script> "+
45 - "DELETE sp FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " + 43 + "DELETE sp FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " +
46 "<foreach collection='streamPushItems' item='item' separator='or'>" + 44 "<foreach collection='streamPushItems' item='item' separator='or'>" +
47 - "(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gbId is null) " + 45 + "(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gb_id is null) " +
48 "</foreach>" + 46 "</foreach>" +
49 "</script>") 47 "</script>")
50 int delAllWithoutGBId(List<StreamPushItem> streamPushItems); 48 int delAllWithoutGBId(List<StreamPushItem> streamPushItems);
51 49
52 @Delete("<script> "+ 50 @Delete("<script> "+
53 - "DELETE FROM stream_push where " + 51 + "DELETE FROM wvp_stream_push where " +
54 "<foreach collection='streamPushItems' item='item' separator='or'>" + 52 "<foreach collection='streamPushItems' item='item' separator='or'>" +
55 "(app=#{item.app} and stream=#{item.stream}) " + 53 "(app=#{item.app} and stream=#{item.stream}) " +
56 "</foreach>" + 54 "</foreach>" +
@@ -58,7 +56,7 @@ public interface StreamPushMapper { @@ -58,7 +56,7 @@ public interface StreamPushMapper {
58 int delAll(List<StreamPushItem> streamPushItems); 56 int delAll(List<StreamPushItem> streamPushItems);
59 57
60 @Delete("<script> "+ 58 @Delete("<script> "+
61 - "DELETE FROM stream_push where " + 59 + "DELETE FROM wvp_stream_push where " +
62 "<foreach collection='gbStreams' item='item' separator='or'>" + 60 "<foreach collection='gbStreams' item='item' separator='or'>" +
63 "(app=#{item.app} and stream=#{item.stream}) " + 61 "(app=#{item.app} and stream=#{item.stream}) " +
64 "</foreach>" + 62 "</foreach>" +
@@ -69,30 +67,30 @@ public interface StreamPushMapper { @@ -69,30 +67,30 @@ public interface StreamPushMapper {
69 @Select(value = {" <script>" + 67 @Select(value = {" <script>" +
70 "SELECT " + 68 "SELECT " +
71 "st.*, " + 69 "st.*, " +
72 - "gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + 70 + "gs.gb_id, gs.name, gs.longitude, gs.latitude, gs.gb_stream_id " +
73 "from " + 71 "from " +
74 - "stream_push st " +  
75 - "LEFT JOIN gb_stream gs " + 72 + "wvp_stream_push st " +
  73 + "LEFT join wvp_gb_stream gs " +
76 "on st.app = gs.app AND st.stream = gs.stream " + 74 "on st.app = gs.app AND st.stream = gs.stream " +
77 "WHERE " + 75 "WHERE " +
78 "1=1 " + 76 "1=1 " +
79 - " <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> " +  
80 - " <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" +  
81 - " <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" +  
82 - " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +  
83 - "order by st.createTime desc" + 77 + " <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> " +
  78 + " <if test='pushing == true' > AND (gs.gb_id is null OR st.push_ing=1)</if>" +
  79 + " <if test='pushing == false' > AND (st.push_ing is null OR st.push_ing=0) </if>" +
  80 + " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
  81 + "order by st.create_time desc" +
84 " </script>"}) 82 " </script>"})
85 List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); 83 List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
86 84
87 - @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") 85 + @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")
88 List<StreamPushItem> selectAll(); 86 List<StreamPushItem> selectAll();
89 87
90 - @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}") 88 + @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}")
91 StreamPushItem selectOne(String app, String stream); 89 StreamPushItem selectOne(String app, String stream);
92 90
93 @Insert("<script>" + 91 @Insert("<script>" +
94 - "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +  
95 - "createTime, aliveSecond, mediaServerId, status, pushIng) " + 92 + "Insert IGNORE INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
  93 + "create_time, alive_second, media_server_id, status, push_ing) " +
96 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + 94 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
97 "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " + 95 "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " +
98 "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," + 96 "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," +
@@ -102,37 +100,37 @@ public interface StreamPushMapper { @@ -102,37 +100,37 @@ public interface StreamPushMapper {
102 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") 100 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
103 int addAll(List<StreamPushItem> streamPushItems); 101 int addAll(List<StreamPushItem> streamPushItems);
104 102
105 - @Delete("DELETE FROM stream_push") 103 + @Delete("DELETE FROM wvp_stream_push")
106 void clear(); 104 void clear();
107 105
108 - @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 ") 106 + @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 ")
109 void deleteWithoutGBId(String mediaServerId); 107 void deleteWithoutGBId(String mediaServerId);
110 108
111 - @Select("SELECT * FROM stream_push WHERE mediaServerId=#{mediaServerId}") 109 + @Select("SELECT * FROM wvp_stream_push WHERE media_server_id=#{mediaServerId}")
112 List<StreamPushItem> selectAllByMediaServerId(String mediaServerId); 110 List<StreamPushItem> selectAllByMediaServerId(String mediaServerId);
113 111
114 - @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") 112 + @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")
115 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); 113 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
116 114
117 - @Update("UPDATE stream_push " + 115 + @Update("UPDATE wvp_stream_push " +
118 "SET status=#{status} " + 116 "SET status=#{status} " +
119 "WHERE app=#{app} AND stream=#{stream}") 117 "WHERE app=#{app} AND stream=#{stream}")
120 int updateStatus(String app, String stream, boolean status); 118 int updateStatus(String app, String stream, boolean status);
121 119
122 - @Update("UPDATE stream_push " +  
123 - "SET pushIng=#{pushIng} " + 120 + @Update("UPDATE wvp_stream_push " +
  121 + "SET push_ing=#{pushIng} " +
124 "WHERE app=#{app} AND stream=#{stream}") 122 "WHERE app=#{app} AND stream=#{stream}")
125 int updatePushStatus(String app, String stream, boolean pushIng); 123 int updatePushStatus(String app, String stream, boolean pushIng);
126 124
127 - @Update("UPDATE stream_push " + 125 + @Update("UPDATE wvp_stream_push " +
128 "SET status=#{status} " + 126 "SET status=#{status} " +
129 - "WHERE mediaServerId=#{mediaServerId}") 127 + "WHERE media_server_id=#{mediaServerId}")
130 void updateStatusByMediaServerId(String mediaServerId, boolean status); 128 void updateStatusByMediaServerId(String mediaServerId, boolean status);
131 129
132 130
133 @Select("<script> "+ 131 @Select("<script> "+
134 - "SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +  
135 - "where sp.status = 1 and (gs.app, gs.stream) in (" + 132 + "SELECT gs.* FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
  133 + "where sp.status = true and (gs.app, gs.stream) in (" +
136 "<foreach collection='offlineStreams' item='item' separator=','>" + 134 "<foreach collection='offlineStreams' item='item' separator=','>" +
137 "(#{item.app}, #{item.stream}) " + 135 "(#{item.app}, #{item.stream}) " +
138 "</foreach>" + 136 "</foreach>" +
@@ -140,7 +138,7 @@ public interface StreamPushMapper { @@ -140,7 +138,7 @@ public interface StreamPushMapper {
140 List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams); 138 List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams);
141 139
142 @Update("<script> "+ 140 @Update("<script> "+
143 - "UPDATE stream_push SET status=0 where (app, stream) in (" + 141 + "UPDATE wvp_stream_push SET status=0 where (app, stream) in (" +
144 "<foreach collection='offlineStreams' item='item' separator=','>" + 142 "<foreach collection='offlineStreams' item='item' separator=','>" +
145 "(#{item.app}, #{item.stream}) " + 143 "(#{item.app}, #{item.stream}) " +
146 "</foreach>" + 144 "</foreach>" +
@@ -148,7 +146,7 @@ public interface StreamPushMapper { @@ -148,7 +146,7 @@ public interface StreamPushMapper {
148 void offline(List<StreamPushItemFromRedis> offlineStreams); 146 void offline(List<StreamPushItemFromRedis> offlineStreams);
149 147
150 @Select("<script> "+ 148 @Select("<script> "+
151 - "SELECT * FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + 149 + "SELECT * FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
152 "where sp.status = 0 and (gs.app, gs.stream) in (" + 150 "where sp.status = 0 and (gs.app, gs.stream) in (" +
153 "<foreach collection='onlineStreams' item='item' separator=','>" + 151 "<foreach collection='onlineStreams' item='item' separator=','>" +
154 "(#{item.app}, #{item.stream}) " + 152 "(#{item.app}, #{item.stream}) " +
@@ -157,25 +155,25 @@ public interface StreamPushMapper { @@ -157,25 +155,25 @@ public interface StreamPushMapper {
157 List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams); 155 List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams);
158 156
159 @Update("<script> "+ 157 @Update("<script> "+
160 - "UPDATE stream_push SET status=1 where (app, stream) in (" + 158 + "UPDATE wvp_stream_push SET status=1 where (app, stream) in (" +
161 "<foreach collection='onlineStreams' item='item' separator=','>" + 159 "<foreach collection='onlineStreams' item='item' separator=','>" +
162 "(#{item.app}, #{item.stream}) " + 160 "(#{item.app}, #{item.stream}) " +
163 "</foreach>" + 161 "</foreach>" +
164 ")</script>") 162 ")</script>")
165 void online(List<StreamPushItemFromRedis> onlineStreams); 163 void online(List<StreamPushItemFromRedis> onlineStreams);
166 164
167 - @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") 165 + @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")
168 List<GbStream> getOnlinePusherForGb(); 166 List<GbStream> getOnlinePusherForGb();
169 167
170 - @Update("UPDATE stream_push SET status=0") 168 + @Update("UPDATE wvp_stream_push SET status=0")
171 void setAllStreamOffline(); 169 void setAllStreamOffline();
172 170
173 - @Select("SELECT CONCAT(app,stream) FROM gb_stream") 171 + @Select("SELECT CONCAT(app,stream) from wvp_gb_stream")
174 List<String> getAllAppAndStream(); 172 List<String> getAllAppAndStream();
175 173
176 @Select(value = {" <script>" + 174 @Select(value = {" <script>" +
177 - " <if test='pushIngAsOnline == true'> select count(1) as total, sum(pushIng) as online from stream_push </if>" +  
178 - " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from stream_push </if>" + 175 + " <if test='pushIngAsOnline == true'> select count(1) as total, sum(push_ing) as online from wvp_stream_push </if>" +
  176 + " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from wvp_stream_push </if>" +
179 " </script>"}) 177 " </script>"})
180 ResourceBaceInfo getOverview(boolean pushIngAsOnline); 178 ResourceBaceInfo getOverview(boolean pushIngAsOnline);
181 } 179 }
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
@@ -10,56 +10,56 @@ import java.util.List; @@ -10,56 +10,56 @@ import java.util.List;
10 @Repository 10 @Repository
11 public interface UserMapper { 11 public interface UserMapper {
12 12
13 - @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + 13 + @Insert("INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time) VALUES" +
14 "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})") 14 "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})")
15 int add(User user); 15 int add(User user);
16 16
17 @Update(value = {" <script>" + 17 @Update(value = {" <script>" +
18 - "UPDATE user " +  
19 - "SET updateTime=#{updateTime} " +  
20 - "<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" +  
21 - "<if test=\"role != null\">, roleId=#{role.id}</if>" + 18 + "UPDATE wvp_user " +
  19 + "SET update_time=#{updateTime} " +
  20 + "<if test=\"pushKey != null\">, push_key=#{pushKey}</if>" +
  21 + "<if test=\"role != null\">, role_id=#{role.id}</if>" +
22 "<if test=\"password != null\">, password=#{password}</if>" + 22 "<if test=\"password != null\">, password=#{password}</if>" +
23 "<if test=\"username != null\">, username=#{username}</if>" + 23 "<if test=\"username != null\">, username=#{username}</if>" +
24 "WHERE id=#{id}" + 24 "WHERE id=#{id}" +
25 " </script>"}) 25 " </script>"})
26 int update(User user); 26 int update(User user);
27 27
28 - @Delete("DELETE FROM user WHERE id != 1 and id=#{id}") 28 + @Delete("DELETE from wvp_user WHERE id != 1 and id=#{id}")
29 int delete(int id); 29 int delete(int id);
30 30
31 - @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}") 31 + @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}")
32 @Results(id = "roleMap", value = { 32 @Results(id = "roleMap", value = {
33 - @Result(column = "roleID", property = "role.id"),  
34 - @Result(column = "roleName", property = "role.name"),  
35 - @Result(column = "roleAuthority", property = "role.authority"),  
36 - @Result(column = "roleCreateTime", property = "role.createTime"),  
37 - @Result(column = "roleUpdateTime", property = "role.updateTime") 33 + @Result(column = "role_id", property = "role.id"),
  34 + @Result(column = "role_name", property = "role.name"),
  35 + @Result(column = "role_authority", property = "role.authority"),
  36 + @Result(column = "role_create_time", property = "role.createTime"),
  37 + @Result(column = "role_update_time", property = "role.updateTime")
38 }) 38 })
39 User select(String username, String password); 39 User select(String username, String password);
40 40
41 - @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}") 41 + @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}")
42 @ResultMap(value="roleMap") 42 @ResultMap(value="roleMap")
43 User selectById(int id); 43 User selectById(int id);
44 44
45 - @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}") 45 + @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}")
46 @ResultMap(value="roleMap") 46 @ResultMap(value="roleMap")
47 User getUserByUsername(String username); 47 User getUserByUsername(String username);
48 48
49 - @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") 49 + @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")
50 @ResultMap(value="roleMap") 50 @ResultMap(value="roleMap")
51 List<User> selectAll(); 51 List<User> selectAll();
52 52
53 - @Select("select * from (select user.*, concat(concat(#{callId}, '_'), pushKey) as str1 from user) as u where md5(u.str1) = #{sign}") 53 + @Select("select * from (select user.*, concat(concat(#{call_id}, '_'), push_key) as str1 from wvp_user) as u where md5(u.str1) = #{sign}")
54 List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign); 54 List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
55 55
56 - @Select("select * from user where md5(pushKey) = #{sign}") 56 + @Select("select * from wvp_user where md5(push_key) = #{sign}")
57 List<User> checkPushAuthorityByCallId(String sign); 57 List<User> checkPushAuthorityByCallId(String sign);
58 58
59 - @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") 59 + @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")
60 @ResultMap(value="roleMap") 60 @ResultMap(value="roleMap")
61 List<User> getUsers(); 61 List<User> getUsers();
62 62
63 - @Update("update user set pushKey=#{pushKey} where id=#{id}") 63 + @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}")
64 int changePushKey(int id, String pushKey); 64 int changePushKey(int id, String pushKey);
65 } 65 }
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -561,7 +561,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -561,7 +561,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
561 561
562 @Override 562 @Override
563 public boolean deviceIsOnline(String deviceId) { 563 public boolean deviceIsOnline(String deviceId) {
564 - return getDevice(deviceId).getOnline() == 1; 564 + return getDevice(deviceId).isOnline();
565 } 565 }
566 566
567 567
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
@@ -90,7 +90,7 @@ public class ApiDeviceController { @@ -90,7 +90,7 @@ public class ApiDeviceController {
90 deviceJsonObject.put("RecvStreamIP", ""); 90 deviceJsonObject.put("RecvStreamIP", "");
91 deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期 91 deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期
92 deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅 92 deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅
93 - deviceJsonObject.put("Online", device.getOnline() == 1); 93 + deviceJsonObject.put("Online", device.isOnline());
94 deviceJsonObject.put("Password", ""); 94 deviceJsonObject.put("Password", "");
95 deviceJsonObject.put("MediaTransport", device.getTransport()); 95 deviceJsonObject.put("MediaTransport", device.getTransport());
96 deviceJsonObject.put("RemoteIP", device.getIp()); 96 deviceJsonObject.put("RemoteIP", device.getIp());
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
@@ -92,7 +92,7 @@ public class ApiStreamController { @@ -92,7 +92,7 @@ public class ApiStreamController {
92 result.put("error","device[ " + serial + " ]未找到"); 92 result.put("error","device[ " + serial + " ]未找到");
93 resultDeferredResult.setResult(result); 93 resultDeferredResult.setResult(result);
94 return resultDeferredResult; 94 return resultDeferredResult;
95 - }else if (device.getOnline() == 0) { 95 + }else if (!device.isOnline()) {
96 JSONObject result = new JSONObject(); 96 JSONObject result = new JSONObject();
97 result.put("error","device[ " + code + " ]offline"); 97 result.put("error","device[ " + code + " ]offline");
98 resultDeferredResult.setResult(result); 98 resultDeferredResult.setResult(result);