From d849352441eaf2ef3398eb25cd0f933ff59beec9 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 12 五月 2023 10:37:03 +0800 Subject: [PATCH] 重构以适配postgresql --- src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java | 70 +++++++++++++++++----------------- 1 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java index ae130cf..3aeb0e0 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java @@ -21,13 +21,13 @@ * 鏌ヨ鍒楄〃閲屽凡缁忓叧鑱旂殑 */ @Select("<script> "+ - "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + + "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + "</script>") List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); @Insert("<script> "+ - "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" + + "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" + "<foreach collection='channelReducesToAdd' item='item' separator=','>" + " (#{platformId}, #{item.id} , #{item.catalogId} )" + "</foreach>" + @@ -35,50 +35,50 @@ int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); @Delete("<script> "+ - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + "</script>") int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); @Delete("<script> "+ - "DELETE FROM platform_gb_channel WHERE deviceChannelId in " + - "( select temp.deviceChannelId from " + - "(select pgc.deviceChannelId from platform_gb_channel pgc " + - "left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " + + "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " + + "( select temp.device_channel_id from " + + "(select pgc.device_channel_id from wvp_platform_gb_channel pgc " + + "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " + ") temp)" + "</script>") int delChannelForDeviceId(String deviceId); @Delete("<script> "+ - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" + + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" + "</script>") int cleanChannelForGB(String platformId); - @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId=#{channelId} and pgc.platformId=#{platformId}") + @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); - @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") + @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); - @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + - " from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " + - " where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") + @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + + " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " + + " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); @Select("select d.*\n" + - "from platform_gb_channel pgc\n" + - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" + - " left join device d on dc.deviceId = d.deviceId\n" + - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") + "from wvp_platform_gb_channel pgc\n" + + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + + " left join wvp_device d on dc.device_id = d.device_id\n" + + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); @Delete("<script> "+ - "DELETE FROM platform_gb_channel WHERE catalogId=#{id}" + + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" + "</script>") int delByCatalogId(String id); @Delete("<script> "+ - "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" + "</script>") int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); @@ -86,35 +86,35 @@ "SELECT " + "pp.* " + "FROM " + - "parent_platform pp " + - "left join platform_gb_channel pgc on " + - "pp.serverGBId = pgc.platformId " + - "left join device_channel dc on " + - "dc.id = pgc.deviceChannelId " + + "wvp_platform pp " + + "left join wvp_platform_gb_channel pgc on " + + "pp.server_gb_id = pgc.platform_id " + + "left join wvp_device_channel dc on " + + "dc.id = pgc.device_channel_id " + "WHERE " + - "dc.channelId = #{channelId} and pp.status = true " + - "AND pp.serverGBId IN" + - "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + + "dc.channel_id = #{channelId} and pp.status = true " + + "AND pp.server_gb_id IN" + + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + "</script> ") List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); @Delete("<script> " + - "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" + + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" + "</script>") void delByPlatformId(String serverGBId); @Delete("<script> " + - "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" + + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" + "</script>") int delChannelForGBByCatalogId(String platformId, String catalogId); - @Select("select dc.channelId deviceId,dc.name,d.manufacturer,d.model,d.firmware\n" + - "from platform_gb_channel pgc\n" + - " left join device_channel dc on dc.id = pgc.deviceChannelId\n" + - " left join device d on dc.deviceId = d.deviceId\n" + - "where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") + @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + + "from wvp_platform_gb_channel pgc\n" + + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + + " left join wvp_device d on dc.device_id = d.device_id\n" + + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId); - @Select("SELECT pgc.platformId FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}'") + @Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'") List<String> queryParentPlatformByChannelId(String channelId); } -- Gitblit v1.8.0