From fee539222027f69995ae455f02e719e55e371079 Mon Sep 17 00:00:00 2001 From: xubinbin <1323875150@qq.com> Date: Wed, 28 Dec 2022 13:26:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8#=E6=9B=BF=E4=BB=A3$=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2SQL=E6=B3=A8=E5=85=A5=E7=9A=84=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=EF=BC=88=E4=B8=BB=E8=A6=81=E9=98=B2=E6=AD=A2=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E6=9F=A5=E8=AF=A2sql=E9=83=A8=E5=88=86=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/storager/dao/DeviceAlarmMapper.java | 20 +- .../vmp/storager/dao/DeviceChannelMapper.java | 172 +++++++++--------- .../iot/vmp/storager/dao/DeviceMapper.java | 60 +++--- .../dao/DeviceMobilePositionMapper.java | 2 +- .../iot/vmp/storager/dao/GbStreamMapper.java | 18 +- .../iot/vmp/storager/dao/LogMapper.java | 10 +- .../vmp/storager/dao/MediaServerMapper.java | 124 ++++++------- .../storager/dao/ParentPlatformMapper.java | 8 +- .../storager/dao/PlatformChannelMapper.java | 16 +- .../storager/dao/PlatformGbStreamMapper.java | 2 +- .../iot/vmp/storager/dao/RecordInfoDao.java | 4 +- .../iot/vmp/storager/dao/RoleMapper.java | 8 +- .../vmp/storager/dao/StreamProxyMapper.java | 14 +- .../vmp/storager/dao/StreamPushMapper.java | 36 ++-- .../iot/vmp/storager/dao/UserMapper.java | 16 +- 15 files changed, 255 insertions(+), 255 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java index bc651ce7..f67e152f 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java @@ -16,19 +16,19 @@ import java.util.List; public interface DeviceAlarmMapper { @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + - "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')") + "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})") int add(DeviceAlarm alarm); @Select(value = {" "}) List query(String deviceId, String alarmPriority, String alarmMethod, @@ -38,10 +38,10 @@ public interface DeviceAlarmMapper { @Delete(" " ) int clearAlarmBeforeTime(Integer id, List deviceIdList, String time); 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 53072b2d..d8d7b580 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -20,46 +20,46 @@ public interface DeviceChannelMapper { "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + - "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + - "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " + - "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, ${hasAudio}, '${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')") + "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + + "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + + "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + + "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime})") int add(DeviceChannel channel); @Update(value = {" "}) int update(DeviceChannel channel); @@ -70,7 +70,7 @@ public interface DeviceChannelMapper { "device_channel dc " + "WHERE " + "dc.deviceId = #{deviceId} " + - " AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%') " + +" AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%')) " + " AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) " + " AND dc.status=1" + " AND dc.status=0" + @@ -110,7 +110,7 @@ public interface DeviceChannelMapper { " LEFT JOIN device de ON dc.deviceId = de.deviceId " + " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + " WHERE 1=1 " + - " AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%') " + + " AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%')) " + " AND dc.status=1 " + " AND dc.status=0 " + " AND dc.subCount > 0 " + @@ -151,14 +151,14 @@ public interface DeviceChannelMapper { " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + "values " + " " + - "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " + - "'${item.owner}', '${item.civilCode}', '${item.block}',${item.subCount}," + - "'${item.address}', ${item.parental}, '${item.parentId}', ${item.safetyWay}, ${item.registerWay}, " + - "'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " + - "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " + - "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " + - "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84}, ${item.hasAudio},'${item.createTime}', '${item.updateTime}', " + - "'${item.businessGroupId}', '${item.gpsTime}') " + + "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + + "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + + "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + + "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + + "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + + "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + + "#{item.businessGroupId}, #{item.gpsTime}) " + " " + "ON DUPLICATE KEY UPDATE " + "updateTime=VALUES(updateTime), " + @@ -203,39 +203,39 @@ public interface DeviceChannelMapper { "" + " UPDATE" + " device_channel" + - " SET updateTime='${item.updateTime}'" + - ", name='${item.name}'" + - ", manufacture='${item.manufacture}'" + - ", model='${item.model}'" + - ", owner='${item.owner}'" + - ", civilCode='${item.civilCode}'" + - ", block='${item.block}'" + - ", block=${item.subCount}" + - ", address='${item.address}'" + - ", parental=${item.parental}" + - ", parentId='${item.parentId}'" + - ", safetyWay=${item.safetyWay}" + - ", registerWay=${item.registerWay}" + - ", certNum='${item.certNum}'" + - ", certifiable=${item.certifiable}" + - ", errCode=${item.errCode}" + - ", secrecy='${item.secrecy}'" + - ", ipAddress='${item.ipAddress}'" + - ", port=${item.port}" + - ", password='${item.password}'" + - ", PTZType=${item.PTZType}" + - ", status='${item.status}'" + - ", streamId='${item.streamId}'" + - ", hasAudio=${item.hasAudio}" + - ", longitude=${item.longitude}" + - ", latitude=${item.latitude}" + - ", longitudeGcj02=${item.longitudeGcj02}" + - ", latitudeGcj02=${item.latitudeGcj02}" + - ", longitudeWgs84=${item.longitudeWgs84}" + - ", latitudeWgs84=${item.latitudeWgs84}" + + " SET updateTime=#{item.updateTime}" + + ", name=#{item.name}" + + ", manufacture=#{item.manufacture}" + + ", model=#{item.model}" + + ", owner=#{item.owner}" + + ", civilCode=#{item.civilCode}" + + ", block=#{item.block}" + + ", block=#{item.subCount}" + + ", address=#{item.address}" + + ", parental=#{item.parental}" + + ", parentId=#{item.parentId}" + + ", safetyWay=#{item.safetyWay}" + + ", registerWay=#{item.registerWay}" + + ", certNum=#{item.certNum}" + + ", certifiable=#{item.certifiable}" + + ", errCode=#{item.errCode}" + + ", secrecy=#{item.secrecy}" + + ", ipAddress=#{item.ipAddress}" + + ", port=#{item.port}" + + ", password=#{item.password}" + + ", PTZType=#{item.PTZType}" + + ", status=#{item.status}" + + ", streamId=#{item.streamId}" + + ", hasAudio=#{item.hasAudio}" + + ", longitude=#{item.longitude}" + + ", latitude=#{item.latitude}" + + ", longitudeGcj02=#{item.longitudeGcj02}" + + ", latitudeGcj02=#{item.latitudeGcj02}" + + ", longitudeWgs84=#{item.longitudeWgs84}" + + ", latitudeWgs84=#{item.latitudeWgs84}" + ", businessGroupId=#{item.businessGroupId}" + ", gpsTime=#{item.gpsTime}" + - "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+ + "WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+ "" + ""}) int batchUpdate(List updateChannels); @@ -248,7 +248,7 @@ public interface DeviceChannelMapper { "device_channel dc1 " + "WHERE " + "dc1.deviceId = #{deviceId} " + - " AND (dc1.channelId LIKE '%${query}%' OR dc1.name LIKE '%${query}%' OR dc1.name LIKE '%${query}%') " + + " AND (dc1.channelId LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%')) " + " AND dc1.parentId=#{parentChannelId} " + " AND dc1.status=1" + " AND dc1.status=0" + @@ -286,13 +286,13 @@ public interface DeviceChannelMapper { @Update(value = {" "}) @@ -309,10 +309,10 @@ public interface DeviceChannelMapper { "select * " + "from device_channel " + "where deviceId=#{deviceId}" + - " and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} " + - " and parentId = #{parentId} or length(channelId)=${length} " + + " and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} and length(channelId)=#{length} " + + " and parentId = #{parentId} or length(channelId)=#{length} " + " and parentId = #{parentId} " + - " and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} " + + " and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} " + " "}) List getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java index 0e616921..a0249e58 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java @@ -104,21 +104,21 @@ public interface DeviceMapper { @Update(value = {" "}) int update(Device device); @@ -217,28 +217,28 @@ public interface DeviceMapper { "geoCoordSys," + "treeType," + "online" + - " FROM device WHERE ip = #{host} AND port=${port}") + " FROM device WHERE ip = #{host} AND port=#{port}") Device getDeviceByHostAndPort(String host, int port); @Update(value = {" "}) int updateCustom(Device device); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java index 616b1b74..358836c4 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java @@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.*; public interface DeviceMobilePositionMapper { @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + - "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')") + "VALUES (#{deviceId},#{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})") int insertNewPosition(MobilePosition mobilePosition); @Select(value = {" ") @@ -71,7 +71,7 @@ public interface GbStreamMapper { @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.gbStreamId " + - "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") + "WHERE gs.gbId = #{gbId} AND pgs.platformId = #{platformId}") GbStream queryStreamInPlatform(String platformId, String gbId); @Select("") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") @@ -134,7 +134,7 @@ public interface GbStreamMapper { "" + " UPDATE" + " gb_stream" + - " SET longitude=${item.lng}, latitude=${item.lat} " + + " SET longitude=#{item.lng}, latitude=#{item.lat} " + "WHERE gbId=#{item.id}"+ "" + ""}) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java index 9716c75a..fb1b4e30 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java @@ -18,16 +18,16 @@ import java.util.List; public interface LogMapper { @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " + - "values ('${name}', '${type}', '${uri}', '${address}', '${result}', ${timing}, '${username}', '${createTime}')") + "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})") int add(LogDto logDto); @Select(value = {""}) List query(String query, String type, String startTime, String endTime); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java index e9254a56..97e74ae8 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java @@ -35,92 +35,92 @@ public interface MediaServerMapper { "hookAliveInterval" + ") VALUES " + "(" + - "'${id}', " + - "'${ip}', " + - "'${hookIp}', " + - "'${sdpIp}', " + - "'${streamIp}', " + - "${httpPort}, " + - "${httpSSlPort}, " + - "${rtmpPort}, " + - "${rtmpSSlPort}, " + - "${rtpProxyPort}, " + - "${rtspPort}, " + - "${rtspSSLPort}, " + - "${autoConfig}, " + - "'${secret}', " + - "${rtpEnable}, " + - "'${rtpPortRange}', " + - "${recordAssistPort}, " + - "${defaultServer}, " + - "'${createTime}', " + - "'${updateTime}', " + - "${hookAliveInterval})") + "#{id}, " + + "#{ip}, " + + "#{hookIp}, " + + "#{sdpIp}, " + + "#{streamIp}, " + + "#{httpPort}, " + + "#{httpSSlPort}, " + + "#{rtmpPort}, " + + "#{rtmpSSlPort}, " + + "#{rtpProxyPort}, " + + "#{rtspPort}, " + + "#{rtspSSLPort}, " + + "#{autoConfig}, " + + "#{secret}, " + + "#{rtpEnable}, " + + "#{rtpPortRange}, " + + "#{recordAssistPort}, " + + "#{defaultServer}, " + + "#{createTime}, " + + "#{updateTime}, " + + "#{hookAliveInterval})") int add(MediaServerItem mediaServerItem); @Update(value = {" "}) int update(MediaServerItem mediaServerItem); @Update(value = {" "}) int updateByHostAndPort(MediaServerItem mediaServerItem); - @Select("SELECT * FROM media_server WHERE id='${id}'") + @Select("SELECT * FROM media_server WHERE id=#{id}") MediaServerItem queryOne(String id); @Select("SELECT * FROM media_server") List queryAll(); - @Delete("DELETE FROM media_server WHERE id='${id}'") + @Delete("DELETE FROM media_server WHERE id=#{id}") void delOne(String id); - @Select("DELETE FROM media_server WHERE ip='${host}' and httpPort=${port}") + @Select("DELETE FROM media_server WHERE ip=#{host} and httpPort=#{port}") void delOneByIPAndPort(String host, int port); @Delete("DELETE FROM media_server WHERE defaultServer=1") int delDefault(); - @Select("SELECT * FROM media_server WHERE ip='${host}' and httpPort=${port}") + @Select("SELECT * FROM media_server WHERE ip=#{host} and httpPort=#{port}") MediaServerItem queryOneByHostAndPort(String host, int port); @Select("SELECT * FROM media_server WHERE defaultServer=1") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java index 554354a8..52025eb5 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java @@ -17,9 +17,9 @@ public interface ParentPlatformMapper { @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + - " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + - " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + - " ${status}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") + " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, " + + " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") int addParentPlatform(ParentPlatform parentPlatform); @Update("UPDATE parent_platform " + @@ -41,7 +41,7 @@ public interface ParentPlatformMapper { "ptz=#{ptz}, " + "rtcp=#{rtcp}, " + "status=#{status}, " + - "startOfflinePush=${startOfflinePush}, " + + "startOfflinePush=#{startOfflinePush}, " + "catalogGroup=#{catalogGroup}, " + "administrativeDivision=#{administrativeDivision}, " + "createTime=#{createTime}, " + 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 120ecb3e..b98b9485 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,22 +21,22 @@ public interface PlatformChannelMapper { * 查询列表里已经关联的 */ @Select("") List findChannelRelatedPlatform(String platformId, List channelReduces); @Insert("") int addChannels(String platformId, List channelReducesToAdd); @Delete("") int delChannelForGB(String platformId, List channelReducesToDel); @@ -50,14 +50,14 @@ public interface PlatformChannelMapper { int delChannelForDeviceId(String deviceId); @Delete("") 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 platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId=#{channelId} and pgc.platformId=#{platformId}") List 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 platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") List 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 " + diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index 13094b98..91a4a5f4 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -26,7 +26,7 @@ public interface PlatformGbStreamMapper { "(gbStreamId, platformId, catalogId) " + "values " + " " + - "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" + + "(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" + " " + "") int batchAdd(List streamPushItems); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java index 2d73982c..a784472f 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java @@ -14,10 +14,10 @@ import java.util.List; public interface RecordInfoDao { @Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" + - "('${app}', '${stream}', '${mediaServerId}', datetime('now','localtime')), '${type}', '${deviceId}', '${channelId}', '${name}'") + "(#{app}, #{stream}, #{mediaServerId}, datetime('now','localtime')), #{type}, #{deviceId}, #{channelId}, #{name}") int add(RecordInfo recordInfo); - @Delete("DELETE FROM user WHERE createTime < '${beforeTime}'") + @Delete("DELETE FROM user WHERE createTime < #{beforeTime}") int deleteBefore(String beforeTime); @Select("select * FROM recordInfo") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java index 66a60b95..425f5e42 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java @@ -12,14 +12,14 @@ import java.util.List; public interface RoleMapper { @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + - "('${name}', '${authority}', '${createTime}', '${updateTime}')") + "(#{name}, #{authority}, #{createTime}, #{updateTime})") int add(Role role); @Update(value = {" "}) int update(Role role); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java index 4ed214da..5dbd8f04 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java @@ -13,9 +13,9 @@ public interface StreamProxyMapper { @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " + "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" + - "('${type}','${name}', '${app}', '${stream}', '${mediaServerId}','${url}', '${src_url}', '${dst_url}', " + - "'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_audio}, ${enable_mp4}, ${enable}, ${status}, " + - "${enable_remove_none_reader}, ${enable_disable_none_reader}, '${createTime}' )") + "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " + + "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " + + "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )") int add(StreamProxyItem streamProxyDto); @Update("UPDATE stream_proxy " + @@ -45,7 +45,7 @@ public interface StreamProxyMapper { @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") List selectAll(); - @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") + @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") List selectForEnable(boolean enable); @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") @@ -53,12 +53,12 @@ public interface StreamProxyMapper { @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} and st.mediaServerId = #{id} order by st.createTime desc") + "WHERE st.enable=#{enable} and st.mediaServerId = #{id} order by st.createTime desc") List selectForEnableInMediaServer(String id, boolean enable); @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.mediaServerId = '${id}' order by st.createTime desc") + "WHERE st.mediaServerId = #{id} order by st.createTime desc") List selectInMediaServer(String id); @Update("UPDATE stream_proxy " + @@ -67,7 +67,7 @@ public interface StreamProxyMapper { void updateStatusByMediaServerId(String mediaServerId, boolean status); @Update("UPDATE stream_proxy " + - "SET status=${status} " + + "SET status=#{status} " + "WHERE app=#{app} AND stream=#{stream}") int updateStatus(String app, String stream, boolean status); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java index ec51f112..492dfe38 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java @@ -17,23 +17,23 @@ public interface StreamPushMapper { @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + - "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + - "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', " + - "${pushIng}, ${self} )") + "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " + + "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " + + "#{pushIng}, #{self} )") int add(StreamPushItem streamPushItem); @Update(value = {" "}) int update(StreamPushItem streamPushItem); @@ -76,7 +76,7 @@ public interface StreamPushMapper { "on st.app = gs.app AND st.stream = gs.stream " + "WHERE " + "1=1 " + - " AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%') " + + " AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%')) " + " AND (gs.gbId is null OR st.pushIng=1)" + " AND (st.pushIng is null OR st.pushIng=0) " + " AND st.mediaServerId=#{mediaServerId} " + @@ -94,9 +94,9 @@ public interface StreamPushMapper { "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + "createTime, aliveSecond, mediaServerId, status, pushIng) " + "VALUES " + - "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " + - "'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}', ${item.status} ," + - " ${item.pushIng} )" + + "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " + + "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," + + " #{item.pushIng} )" + " " + "") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @@ -115,12 +115,12 @@ public interface StreamPushMapper { List selectAllByMediaServerIdWithOutGbID(String mediaServerId); @Update("UPDATE stream_push " + - "SET status=${status} " + + "SET status=#{status} " + "WHERE app=#{app} AND stream=#{stream}") int updateStatus(String app, String stream, boolean status); @Update("UPDATE stream_push " + - "SET pushIng=${pushIng} " + + "SET pushIng=#{pushIng} " + "WHERE app=#{app} AND stream=#{stream}") int updatePushStatus(String app, String stream, boolean pushIng); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java index c7a44fd2..fe72a7d5 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java @@ -11,16 +11,16 @@ import java.util.List; public interface UserMapper { @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + - "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')") + "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})") int add(User user); @Update(value = {" "}) int update(User user); @@ -50,10 +50,10 @@ public interface UserMapper { @ResultMap(value="roleMap") List selectAll(); - @Select("select * from (select user.*, concat('${callId}_', pushKey) as str1 from user) as u where md5(u.str1) = '${sign}'") + @Select("select * from (select user.*, concat(#{callId}_', pushKey) as str1 from user) as u where md5(u.str1) = #{sign}") List checkPushAuthorityByCallIdAndSign(String callId, String sign); - @Select("select * from user where md5(pushKey) = '${sign}'") + @Select("select * from user where md5(pushKey) = #{sign}") List checkPushAuthorityByCallId(String sign); @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")