From 825daad3554bf1f3a42796f56e6057e94ae96f8b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 22 Dec 2024 08:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/provider/StreamProxyProvider.java | 2 +- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 13 +++------- .../2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 14 +++-------- 数据库/2.7.3/更新-mysql-2.7.3.sql | 25 +++++++++++++++++++ .../2.7.3/更新-postgresql-kingbase-2.7.3.sql | 22 ++++++++++++++++ 5 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 数据库/2.7.3/更新-mysql-2.7.3.sql create mode 100644 数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java index 6586fc64..071d7d55 100644 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java @@ -20,7 +20,7 @@ public class StreamProxyProvider { } public String selectForPushingInMediaServer(Map params ){ - return getBaseSelectSql() + " WHERE st.pulling=1 and st.media_server_id=#{mediaServerId} order by st.create_time desc"; + return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc"; } public String selectOneByAppAndStream(Map params ){ diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index e12677da..e50b8c60 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -70,7 +70,6 @@ create table wvp_device_mobile_position create table wvp_device_channel ( id serial primary key, - device_db_id integer, device_id character varying(50), name character varying(255), manufacturer character varying(50), @@ -148,16 +147,12 @@ create table wvp_device_channel gb_svc_space_support_mod integer, gb_svc_time_support_mode integer, record_plan_id integer, - stream_push_id integer, - stream_proxy_id integer, - constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), - constraint uk_wvp_unique_channel unique (gb_device_id), - constraint uk_wvp_unique_stream_push_id unique (stream_push_id), - constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id) + data_type integer, + data_device_id integer, + constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), + constraint uk_wvp_unique_channel unique (gb_device_id) ); -create index uk_wvp_device_db_id on wvp_device_channel (device_db_id); - create table wvp_media_server ( id character varying(255) primary key, diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index c632f9a8..054b84ac 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -86,7 +86,6 @@ create table wvp_gb_stream create table wvp_device_channel ( id serial primary key, - device_db_id integer, device_id character varying(50), name character varying(255), manufacturer character varying(50), @@ -164,17 +163,12 @@ create table wvp_device_channel gb_svc_space_support_mod integer, gb_svc_time_support_mode integer, record_plan_id integer, - stream_push_id integer, - stream_proxy_id integer, - constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), - constraint uk_wvp_unique_channel unique (gb_device_id), - constraint uk_wvp_unique_stream_push_id unique (stream_push_id), - constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id) + data_type integer, + data_device_id integer, + constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), + constraint uk_wvp_unique_channel unique (gb_device_id) ); -create index uk_wvp_device_db_id on wvp_device_channel (device_db_id); - - create table wvp_media_server ( id character varying(255) primary key, diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql new file mode 100644 index 00000000..dcce5891 --- /dev/null +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -0,0 +1,25 @@ +/* +* 20241222 +*/ + +alter table wvp_device_channel + add data_type integer; + +alter table wvp_device_channel + add data_device_id integer; + +update wvp_device_channel wdc INNER JOIN + (SELECT device_db_id from wvp_device_channel where wdc.id = id and device_db_id is not null ) ct +set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null; + +update wvp_device_channel wdc INNER JOIN + (SELECT stream_push_id from wvp_device_channel where wdc.id = id and stream_push_id is not null ) ct +set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null; + +update wvp_device_channel wdc INNER JOIN + (SELECT stream_proxy_id from wvp_device_channel where wdc.id = id and stream_proxy_id is not null ) ct +set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null; + +alter table wvp_device_channel drop device_db_id; +alter table wvp_device_channel drop stream_push_id; +alter table wvp_device_channel drop stream_proxy_id; \ No newline at end of file diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql new file mode 100644 index 00000000..122549e5 --- /dev/null +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -0,0 +1,22 @@ +/* +* 20241222 +*/ + +alter table wvp_device_channel + add data_type integer; + +alter table wvp_device_channel + add data_device_id integer; + +update wvp_device_channel wdc +set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null; + +update wvp_device_channel wdc +set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null; + +update wvp_device_channel wdc +set data_type = 1, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null; + +alter table wvp_device_channel drop device_db_id; +alter table wvp_device_channel drop stream_push_id; +alter table wvp_device_channel drop stream_proxy_id; \ No newline at end of file