From 8aa0bdf539582b9d710503121d911bb166ca7c8e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 06 七月 2022 09:44:37 +0800 Subject: [PATCH] 数据库优化 --- src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java index 55b5379..fa8381c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java @@ -15,10 +15,11 @@ public interface GbStreamMapper { @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + - "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" + + "longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" + "('${app}', '${stream}', '${gbId}', '${name}', " + "'${longitude}', '${latitude}', '${streamType}', " + - "'${mediaServerId}', ${status}, ${createStamp})") + "'${mediaServerId}', ${status}, '${createTime}')") + @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") int add(GbStream gbStream); @Update("UPDATE gb_stream " + @@ -32,6 +33,19 @@ "mediaServerId=#{mediaServerId}," + "status=${status} " + "WHERE app=#{app} AND stream=#{stream}") + int updateByAppAndStream(GbStream gbStream); + + @Update("UPDATE gb_stream " + + "SET app=#{app}," + + "stream=#{stream}," + + "gbId=#{gbId}," + + "name=#{name}," + + "streamType=#{streamType}," + + "longitude=#{longitude}, " + + "latitude=#{latitude}," + + "mediaServerId=#{mediaServerId}," + + "status=${status} " + + "WHERE gbStreamId=#{gbStreamId}") int update(GbStream gbStream); @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") @@ -60,7 +74,7 @@ List<GbStream> selectByGBId(String gbId); @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.catalogId " + + "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") GbStream queryStreamInPlatform(String platformId, String gbId); @@ -106,12 +120,12 @@ @Insert("<script> " + "INSERT IGNORE into gb_stream " + "(app, stream, gbId, name, " + - "longitude, latitude, streamType, mediaServerId, status, createStamp)" + + "longitude, latitude, streamType, mediaServerId, status, createTime)" + "values " + "<foreach collection='subList' index='index' item='item' separator=','> " + "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + - "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+ + "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+ "</foreach> " + "</script>") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") -- Gitblit v1.8.0