From c4aeef62ef54b0706a35348b3d1fc876e1d8be8c Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 4 Dec 2023 21:56:21 +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 --- sql/common.sql | 25 +++----- .../storager/dao/CommonGbChannelMapper.java | 64 +++++++++---------- .../vmp/storager/dao/DeviceChannelMapper.java | 2 +- 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/sql/common.sql b/sql/common.sql index deb1a247..0f3eb5cb 100644 --- a/sql/common.sql +++ b/sql/common.sql @@ -1,4 +1,4 @@ -CREATE TABLE `wvp_common_gb_channel` +CREATE TABLE `wvp_common_channel` ( `common_gb_id` bigint unsigned NOT NULL AUTO_INCREMENT, `common_gb_device_id` varchar(50) NOT NULL, @@ -67,11 +67,11 @@ CREATE TABLE `wvp_common_region` UNIQUE KEY `common_region_device_id` (`common_region_device_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -CREATE TABLE `wvp_common_platform_channel` +CREATE TABLE `wvp_common_channel_platform` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `platform_id` varchar(50) NOT NULL, - `common_gb_channel_id` varchar(50) NOT NULL, + `platform_id` bigint unsigned NOT NULL, + `common_gb_channel_id` bigint unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), UNIQUE KEY `uk_platform_id_common_gb_channel_id` (`platform_id`,`common_gb_channel_id`) @@ -79,17 +79,12 @@ CREATE TABLE `wvp_common_platform_channel` DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -CREATE TABLE `wvp_common_platform_region` -( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `platform_id` varchar(50) NOT NULL, - `region_id` varchar(50) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - UNIQUE KEY `uk_platform_region_id` (`platform_id`,`region_id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_0900_ai_ci; + +drop table wvp_platform_gb_stream; +drop table wvp_platform_gb_channel; +drop table wvp_platform_catalog; +drop table wvp_platform_gb_channel; +drop table wvp_resources_tree; diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java index 441bc882..0f25764f 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java @@ -16,12 +16,12 @@ import java.util.Map; @Repository public interface CommonGbChannelMapper { - @Select(value = "select * from wvp_common_gb_channel where common_gb_business_group_id = '#{commonGroupId}'") + @Select(value = "select * from wvp_common_channel where common_gb_business_group_id = '#{commonGroupId}'") List getChannels(String commonGroupId); @Update(value = "") int removeChannelsForGroup(List channels); - @Select("select * from wvp_common_gb_channel where common_gb_device_id=#{channelId}") + @Select("select * from wvp_common_channel where common_gb_device_id=#{channelId}") CommonGbChannel queryByDeviceID(String channelId); @Insert(value = "") int add(CommonGbChannel channel); - @Delete("delete from wvp_common_gb_channel where common_gb_device_id = #{channelId}") + @Delete("delete from wvp_common_channel where common_gb_device_id = #{channelId}") int deleteByDeviceID(String channelId); @Update(value = "") int deleteByDeviceIDs(List clearChannels); @Update("") void channelsOnlineFromList(List channelList); @Update("") void channelsOfflineFromList(List channelList); @Update("") int clearParentIds(List errorParentIdList); @Update("") void clearCivilCodes(List errorCivilCodeList); @Select("") List queryInList(List commonGbChannelList); @Update("") void updateChanelRegion(@Param("commonRegionDeviceIdForOld") String commonRegionDeviceIdForOld, @Param("commonRegionDeviceIdForNew") String commonRegionDeviceIdForNew); @Update("") void updateChanelGroup( @Param("groupDeviceIdForOld") String groupDeviceIdForOld, @Param("groupDeviceIdForNew") String groupDeviceIdForNew); @Select("") List getChannelsInRegion(@Param("regionDeviceId") String regionDeviceId, @Param("query") String query); @Select("") List query(@Param("query") String query); @Select("") void removeGroupInfo(@Param("groupList") List groupList); @@ -379,7 +379,7 @@ public interface CommonGbChannelMapper { @Update({""}) void removeFromGroupByGroupId(@Param("commonGbBusinessGroupID") String commonGbBusinessGroupID); @Select("") void removeRegionInfo(@Param("regionList") List regionList); @@ -413,7 +413,7 @@ public interface CommonGbChannelMapper { @Update({""}) @@ -431,7 +431,7 @@ public interface CommonGbChannelMapper { @Update({""}) int batchDelete(@Param("ids") List ids); @MapKey("commonGbDeviceID") - @Select("select * from wvp_common_gb_channel") + @Select("select * from wvp_common_channel") Map queryAllChannelsForMap(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index dc1358b3..4ba3cac3 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -476,7 +476,7 @@ public interface DeviceChannelMapper { @Update(" update wvp_device_channel wdc " + " set " + " common_gb_channel_id=" + - " (select wcgc.common_gb_id from wvp_common_gb_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " + + " (select wcgc.common_gb_id from wvp_common_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " + " where wdc.device_id = #{deviceId}") int updateCommonChannelId(@Param("deviceId") String deviceId);