Commit 72132ca70ecd2916ab5be7bb534c2b8d558e4686

Authored by 648540858
Committed by GitHub
2 parents 809e4c98 ce035dbc

Merge pull request #713 from xu-bin-bin/wvp-28181-2.0

使用#替代$,防止SQL注入的风险(主要防止模糊查询sql部分的注入)。
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
@@ -16,19 +16,19 @@ import java.util.List; @@ -16,19 +16,19 @@ import java.util.List;
16 public interface DeviceAlarmMapper { 16 public interface DeviceAlarmMapper {
17 17
18 @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + 18 @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " +
19 - "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')") 19 + "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})")
20 int add(DeviceAlarm alarm); 20 int add(DeviceAlarm alarm);
21 21
22 22
23 @Select(value = {" <script>" + 23 @Select(value = {" <script>" +
24 " SELECT * FROM device_alarm " + 24 " SELECT * FROM device_alarm " +
25 " WHERE 1=1 " + 25 " WHERE 1=1 " +
26 - " <if test=\"deviceId != null\" > AND deviceId = '${deviceId}'</if>" +  
27 - " <if test=\"alarmPriority != null\" > AND alarmPriority = '${alarmPriority}' </if>" +  
28 - " <if test=\"alarmMethod != null\" > AND alarmMethod = '${alarmMethod}' </if>" +  
29 - " <if test=\"alarmType != null\" > AND alarmType = '${alarmType}' </if>" +  
30 - " <if test=\"startTime != null\" > AND alarmTime &gt;= '${startTime}' </if>" +  
31 - " <if test=\"endTime != null\" > AND alarmTime &lt;= '${endTime}' </if>" + 26 + " <if test=\"deviceId != null\" > AND deviceId = #{deviceId}</if>" +
  27 + " <if test=\"alarmPriority != null\" > AND alarmPriority = #{alarmPriority} </if>" +
  28 + " <if test=\"alarmMethod != null\" > AND alarmMethod = #{alarmMethod} </if>" +
  29 + " <if test=\"alarmType != null\" > AND alarmType = #{alarmType} </if>" +
  30 + " <if test=\"startTime != null\" > AND alarmTime &gt;= #{startTime} </if>" +
  31 + " <if test=\"endTime != null\" > AND alarmTime &lt;= #{endTime} </if>" +
32 " ORDER BY alarmTime ASC " + 32 " ORDER BY alarmTime ASC " +
33 " </script>"}) 33 " </script>"})
34 List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, 34 List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
@@ -38,10 +38,10 @@ public interface DeviceAlarmMapper { @@ -38,10 +38,10 @@ public interface DeviceAlarmMapper {
38 @Delete(" <script>" + 38 @Delete(" <script>" +
39 "DELETE FROM device_alarm WHERE 1=1 " + 39 "DELETE FROM device_alarm WHERE 1=1 " +
40 " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " + 40 " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " +
41 - "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > '${item}'</foreach>" + 41 + "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
42 "</if>" + 42 "</if>" +
43 - " <if test=\"time != null and id == null \" > AND alarmTime &lt;= '${time}'</if>" +  
44 - " <if test=\"id != null\" > AND id = ${id}</if>" + 43 + " <if test=\"time != null and id == null \" > AND alarmTime &lt;= #{time}</if>" +
  44 + " <if test=\"id != null\" > AND id = #{id}</if>" +
45 " </script>" 45 " </script>"
46 ) 46 )
47 int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time); 47 int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time);
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -20,46 +20,46 @@ public interface DeviceChannelMapper { @@ -20,46 +20,46 @@ public interface DeviceChannelMapper {
20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + 20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
21 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + 21 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
22 "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + 22 "longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
23 - "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +  
24 - "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +  
25 - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +  
26 - "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, ${hasAudio}, '${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')") 23 + "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," +
  24 + "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " +
  25 + "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " +
  26 + "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime})")
27 int add(DeviceChannel channel); 27 int add(DeviceChannel channel);
28 28
29 @Update(value = {" <script>" + 29 @Update(value = {" <script>" +
30 "UPDATE device_channel " + 30 "UPDATE device_channel " +
31 - "SET updateTime='${updateTime}'" +  
32 - "<if test='name != null'>, name='${name}'</if>" +  
33 - "<if test='manufacture != null'>, manufacture='${manufacture}'</if>" +  
34 - "<if test='model != null'>, model='${model}'</if>" +  
35 - "<if test='owner != null'>, owner='${owner}'</if>" +  
36 - "<if test='civilCode != null'>, civilCode='${civilCode}'</if>" +  
37 - "<if test='block != null'>, block='${block}'</if>" +  
38 - "<if test='address != null'>, address='${address}'</if>" +  
39 - "<if test='parental != null'>, parental=${parental}</if>" +  
40 - "<if test='parentId != null'>, parentId='${parentId}'</if>" +  
41 - "<if test='safetyWay != null'>, safetyWay=${safetyWay}</if>" +  
42 - "<if test='registerWay != null'>, registerWay=${registerWay}</if>" +  
43 - "<if test='certNum != null'>, certNum='${certNum}'</if>" +  
44 - "<if test='certifiable != null'>, certifiable=${certifiable}</if>" +  
45 - "<if test='errCode != null'>, errCode=${errCode}</if>" +  
46 - "<if test='secrecy != null'>, secrecy='${secrecy}'</if>" +  
47 - "<if test='ipAddress != null'>, ipAddress='${ipAddress}'</if>" +  
48 - "<if test='port != null'>, port=${port}</if>" +  
49 - "<if test='password != null'>, password='${password}'</if>" +  
50 - "<if test='PTZType != null'>, PTZType=${PTZType}</if>" +  
51 - "<if test='status != null'>, status='${status}'</if>" +  
52 - "<if test='streamId != null'>, streamId='${streamId}'</if>" +  
53 - "<if test='hasAudio != null'>, hasAudio=${hasAudio}</if>" +  
54 - "<if test='longitude != null'>, longitude=${longitude}</if>" +  
55 - "<if test='latitude != null'>, latitude=${latitude}</if>" +  
56 - "<if test='longitudeGcj02 != null'>, longitudeGcj02=${longitudeGcj02}</if>" +  
57 - "<if test='latitudeGcj02 != null'>, latitudeGcj02=${latitudeGcj02}</if>" +  
58 - "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +  
59 - "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" + 31 + "SET updateTime=#{updateTime}" +
  32 + "<if test='name != null'>, name=#{name}</if>" +
  33 + "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
  34 + "<if test='model != null'>, model=#{model}</if>" +
  35 + "<if test='owner != null'>, owner=#{owner}</if>" +
  36 + "<if test='civilCode != null'>, civilCode=#{civilCode}</if>" +
  37 + "<if test='block != null'>, block=#{block}</if>" +
  38 + "<if test='address != null'>, address=#{address}</if>" +
  39 + "<if test='parental != null'>, parental=#{parental}</if>" +
  40 + "<if test='parentId != null'>, parentId=#{parentId}</if>" +
  41 + "<if test='safetyWay != null'>, safetyWay=#{safetyWay}</if>" +
  42 + "<if test='registerWay != null'>, registerWay=#{registerWay}</if>" +
  43 + "<if test='certNum != null'>, certNum=#{certNum}</if>" +
  44 + "<if test='certifiable != null'>, certifiable=#{certifiable}</if>" +
  45 + "<if test='errCode != null'>, errCode=#{errCode}</if>" +
  46 + "<if test='secrecy != null'>, secrecy=#{secrecy}</if>" +
  47 + "<if test='ipAddress != null'>, ipAddress=#{ipAddress}</if>" +
  48 + "<if test='port != null'>, port=#{port}</if>" +
  49 + "<if test='password != null'>, password=#{password}</if>" +
  50 + "<if test='PTZType != null'>, PTZType=#{PTZType}</if>" +
  51 + "<if test='status != null'>, status=#{status}</if>" +
  52 + "<if test='streamId != null'>, streamId=#{streamId}</if>" +
  53 + "<if test='hasAudio != null'>, hasAudio=#{hasAudio}</if>" +
  54 + "<if test='longitude != null'>, longitude=#{longitude}</if>" +
  55 + "<if test='latitude != null'>, latitude=#{latitude}</if>" +
  56 + "<if test='longitudeGcj02 != null'>, longitudeGcj02=#{longitudeGcj02}</if>" +
  57 + "<if test='latitudeGcj02 != null'>, latitudeGcj02=#{latitudeGcj02}</if>" +
  58 + "<if test='longitudeWgs84 != null'>, longitudeWgs84=#{longitudeWgs84}</if>" +
  59 + "<if test='latitudeWgs84 != null'>, latitudeWgs84=#{latitudeWgs84}</if>" +
60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" + 60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
61 "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" + 61 "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
62 - "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+ 62 + "WHERE deviceId=#{deviceId} AND channelId=#{channelId}"+
63 " </script>"}) 63 " </script>"})
64 int update(DeviceChannel channel); 64 int update(DeviceChannel channel);
65 65
@@ -70,7 +70,7 @@ public interface DeviceChannelMapper { @@ -70,7 +70,7 @@ public interface DeviceChannelMapper {
70 "device_channel dc " + 70 "device_channel dc " +
71 "WHERE " + 71 "WHERE " +
72 "dc.deviceId = #{deviceId} " + 72 "dc.deviceId = #{deviceId} " +
73 - " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + 73 +" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
74 " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " + 74 " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
75 " <if test='online == true' > AND dc.status=1</if>" + 75 " <if test='online == true' > AND dc.status=1</if>" +
76 " <if test='online == false' > AND dc.status=0</if>" + 76 " <if test='online == false' > AND dc.status=0</if>" +
@@ -113,7 +113,7 @@ public interface DeviceChannelMapper { @@ -113,7 +113,7 @@ public interface DeviceChannelMapper {
113 " LEFT JOIN device de ON dc.deviceId = de.deviceId " + 113 " LEFT JOIN device de ON dc.deviceId = de.deviceId " +
114 " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + 114 " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
115 " WHERE 1=1 " + 115 " WHERE 1=1 " +
116 - " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + 116 + " <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
117 " <if test='online == true' > AND dc.status=1</if> " + 117 " <if test='online == true' > AND dc.status=1</if> " +
118 " <if test='online == false' > AND dc.status=0</if> " + 118 " <if test='online == false' > AND dc.status=0</if> " +
119 " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + 119 " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " +
@@ -154,14 +154,14 @@ public interface DeviceChannelMapper { @@ -154,14 +154,14 @@ public interface DeviceChannelMapper {
154 " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + 154 " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
155 "values " + 155 "values " +
156 "<foreach collection='addChannels' index='index' item='item' separator=','> " + 156 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
157 - "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +  
158 - "'${item.owner}', '${item.civilCode}', '${item.block}',${item.subCount}," +  
159 - "'${item.address}', ${item.parental}, '${item.parentId}', ${item.safetyWay}, ${item.registerWay}, " +  
160 - "'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +  
161 - "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +  
162 - "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +  
163 - "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84}, ${item.hasAudio},'${item.createTime}', '${item.updateTime}', " +  
164 - "'${item.businessGroupId}', '${item.gpsTime}') " + 157 + "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
  158 + "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," +
  159 + "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " +
  160 + "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " +
  161 + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " +
  162 + "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " +
  163 + "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " +
  164 + "#{item.businessGroupId}, #{item.gpsTime}) " +
165 "</foreach> " + 165 "</foreach> " +
166 "ON DUPLICATE KEY UPDATE " + 166 "ON DUPLICATE KEY UPDATE " +
167 "updateTime=VALUES(updateTime), " + 167 "updateTime=VALUES(updateTime), " +
@@ -206,39 +206,39 @@ public interface DeviceChannelMapper { @@ -206,39 +206,39 @@ public interface DeviceChannelMapper {
206 "<foreach collection='updateChannels' item='item' separator=';'>" + 206 "<foreach collection='updateChannels' item='item' separator=';'>" +
207 " UPDATE" + 207 " UPDATE" +
208 " device_channel" + 208 " device_channel" +
209 - " SET updateTime='${item.updateTime}'" +  
210 - "<if test='item.name != null'>, name='${item.name}'</if>" +  
211 - "<if test='item.manufacture != null'>, manufacture='${item.manufacture}'</if>" +  
212 - "<if test='item.model != null'>, model='${item.model}'</if>" +  
213 - "<if test='item.owner != null'>, owner='${item.owner}'</if>" +  
214 - "<if test='item.civilCode != null'>, civilCode='${item.civilCode}'</if>" +  
215 - "<if test='item.block != null'>, block='${item.block}'</if>" +  
216 - "<if test='item.subCount != null'>, block=${item.subCount}</if>" +  
217 - "<if test='item.address != null'>, address='${item.address}'</if>" +  
218 - "<if test='item.parental != null'>, parental=${item.parental}</if>" +  
219 - "<if test='item.parentId != null'>, parentId='${item.parentId}'</if>" +  
220 - "<if test='item.safetyWay != null'>, safetyWay=${item.safetyWay}</if>" +  
221 - "<if test='item.registerWay != null'>, registerWay=${item.registerWay}</if>" +  
222 - "<if test='item.certNum != null'>, certNum='${item.certNum}'</if>" +  
223 - "<if test='item.certifiable != null'>, certifiable=${item.certifiable}</if>" +  
224 - "<if test='item.errCode != null'>, errCode=${item.errCode}</if>" +  
225 - "<if test='item.secrecy != null'>, secrecy='${item.secrecy}'</if>" +  
226 - "<if test='item.ipAddress != null'>, ipAddress='${item.ipAddress}'</if>" +  
227 - "<if test='item.port != null'>, port=${item.port}</if>" +  
228 - "<if test='item.password != null'>, password='${item.password}'</if>" +  
229 - "<if test='item.PTZType != null'>, PTZType=${item.PTZType}</if>" +  
230 - "<if test='item.status != null'>, status='${item.status}'</if>" +  
231 - "<if test='item.streamId != null'>, streamId='${item.streamId}'</if>" +  
232 - "<if test='item.hasAudio != null'>, hasAudio=${item.hasAudio}</if>" +  
233 - "<if test='item.longitude != null'>, longitude=${item.longitude}</if>" +  
234 - "<if test='item.latitude != null'>, latitude=${item.latitude}</if>" +  
235 - "<if test='item.longitudeGcj02 != null'>, longitudeGcj02=${item.longitudeGcj02}</if>" +  
236 - "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +  
237 - "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +  
238 - "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" + 209 + " SET updateTime=#{item.updateTime}" +
  210 + "<if test='item.name != null'>, name=#{item.name}</if>" +
  211 + "<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" +
  212 + "<if test='item.model != null'>, model=#{item.model}</if>" +
  213 + "<if test='item.owner != null'>, owner=#{item.owner}</if>" +
  214 + "<if test='item.civilCode != null'>, civilCode=#{item.civilCode}</if>" +
  215 + "<if test='item.block != null'>, block=#{item.block}</if>" +
  216 + "<if test='item.subCount != null'>, block=#{item.subCount}</if>" +
  217 + "<if test='item.address != null'>, address=#{item.address}</if>" +
  218 + "<if test='item.parental != null'>, parental=#{item.parental}</if>" +
  219 + "<if test='item.parentId != null'>, parentId=#{item.parentId}</if>" +
  220 + "<if test='item.safetyWay != null'>, safetyWay=#{item.safetyWay}</if>" +
  221 + "<if test='item.registerWay != null'>, registerWay=#{item.registerWay}</if>" +
  222 + "<if test='item.certNum != null'>, certNum=#{item.certNum}</if>" +
  223 + "<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" +
  224 + "<if test='item.errCode != null'>, errCode=#{item.errCode}</if>" +
  225 + "<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" +
  226 + "<if test='item.ipAddress != null'>, ipAddress=#{item.ipAddress}</if>" +
  227 + "<if test='item.port != null'>, port=#{item.port}</if>" +
  228 + "<if test='item.password != null'>, password=#{item.password}</if>" +
  229 + "<if test='item.PTZType != null'>, PTZType=#{item.PTZType}</if>" +
  230 + "<if test='item.status != null'>, status=#{item.status}</if>" +
  231 + "<if test='item.streamId != null'>, streamId=#{item.streamId}</if>" +
  232 + "<if test='item.hasAudio != null'>, hasAudio=#{item.hasAudio}</if>" +
  233 + "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
  234 + "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
  235 + "<if test='item.longitudeGcj02 != null'>, longitudeGcj02=#{item.longitudeGcj02}</if>" +
  236 + "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=#{item.latitudeGcj02}</if>" +
  237 + "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=#{item.longitudeWgs84}</if>" +
  238 + "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=#{item.latitudeWgs84}</if>" +
239 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" + 239 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
240 "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" + 240 "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
241 - "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+ 241 + "WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+
242 "</foreach>" + 242 "</foreach>" +
243 "</script>"}) 243 "</script>"})
244 int batchUpdate(List<DeviceChannel> updateChannels); 244 int batchUpdate(List<DeviceChannel> updateChannels);
@@ -251,7 +251,7 @@ public interface DeviceChannelMapper { @@ -251,7 +251,7 @@ public interface DeviceChannelMapper {
251 "device_channel dc1 " + 251 "device_channel dc1 " +
252 "WHERE " + 252 "WHERE " +
253 "dc1.deviceId = #{deviceId} " + 253 "dc1.deviceId = #{deviceId} " +
254 - " <if test='query != null'> AND (dc1.channelId LIKE '%${query}%' OR dc1.name LIKE '%${query}%' OR dc1.name LIKE '%${query}%')</if> " + 254 + " <if test='query != null'> AND (dc1.channelId LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%'))</if> " +
255 " <if test='parentChannelId != null'> AND dc1.parentId=#{parentChannelId} </if> " + 255 " <if test='parentChannelId != null'> AND dc1.parentId=#{parentChannelId} </if> " +
256 " <if test='online == true' > AND dc1.status=1</if>" + 256 " <if test='online == true' > AND dc1.status=1</if>" +
257 " <if test='online == false' > AND dc1.status=0</if>" + 257 " <if test='online == false' > AND dc1.status=0</if>" +
@@ -292,13 +292,13 @@ public interface DeviceChannelMapper { @@ -292,13 +292,13 @@ public interface DeviceChannelMapper {
292 @Update(value = {" <script>" + 292 @Update(value = {" <script>" +
293 "UPDATE device_channel " + 293 "UPDATE device_channel " +
294 "SET " + 294 "SET " +
295 - "latitude=${latitude}, " +  
296 - "longitude=${longitude}, " +  
297 - "longitudeGcj02=${longitudeGcj02}, " +  
298 - "latitudeGcj02=${latitudeGcj02}, " +  
299 - "longitudeWgs84=${longitudeWgs84}, " +  
300 - "latitudeWgs84=${latitudeWgs84}, " +  
301 - "gpsTime='${gpsTime}' " + 295 + "latitude=#{latitude}, " +
  296 + "longitude=#{longitude}, " +
  297 + "longitudeGcj02=#{longitudeGcj02}, " +
  298 + "latitudeGcj02=#{latitudeGcj02}, " +
  299 + "longitudeWgs84=#{longitudeWgs84}, " +
  300 + "latitudeWgs84=#{latitudeWgs84}, " +
  301 + "gpsTime=#{gpsTime} " +
302 "WHERE deviceId=#{deviceId} " + 302 "WHERE deviceId=#{deviceId} " +
303 " <if test='channelId != null' > AND channelId=#{channelId}</if>" + 303 " <if test='channelId != null' > AND channelId=#{channelId}</if>" +
304 " </script>"}) 304 " </script>"})
@@ -315,10 +315,10 @@ public interface DeviceChannelMapper { @@ -315,10 +315,10 @@ public interface DeviceChannelMapper {
315 "select * " + 315 "select * " +
316 "from device_channel " + 316 "from device_channel " +
317 "where deviceId=#{deviceId}" + 317 "where deviceId=#{deviceId}" +
318 - " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" +  
319 - " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" + 318 + " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} and length(channelId)=#{length} </if>" +
  319 + " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=#{length} </if>" +
320 " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" + 320 " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +
321 - " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" + 321 + " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} </if>" +
322 " </script>"}) 322 " </script>"})
323 List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); 323 List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
324 324
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -106,22 +106,22 @@ public interface DeviceMapper { @@ -106,22 +106,22 @@ public interface DeviceMapper {
106 106
107 @Update(value = {" <script>" + 107 @Update(value = {" <script>" +
108 "UPDATE device " + 108 "UPDATE device " +
109 - "SET updateTime='${updateTime}'" +  
110 - "<if test=\"name != null\">, name='${name}'</if>" +  
111 - "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +  
112 - "<if test=\"model != null\">, model='${model}'</if>" +  
113 - "<if test=\"firmware != null\">, firmware='${firmware}'</if>" +  
114 - "<if test=\"transport != null\">, transport='${transport}'</if>" +  
115 - "<if test=\"ip != null\">, ip='${ip}'</if>" +  
116 - "<if test=\"localIp != null\">, localIp='${localIp}'</if>" +  
117 - "<if test=\"port != null\">, port=${port}</if>" +  
118 - "<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +  
119 - "<if test=\"online != null\">, online=${online}</if>" +  
120 - "<if test=\"registerTime != null\">, registerTime='${registerTime}'</if>" +  
121 - "<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" +  
122 - "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime='${keepaliveIntervalTime}'</if>" +  
123 - "<if test=\"expires != null\">, expires=${expires}</if>" +  
124 - "WHERE deviceId='${deviceId}'"+ 109 + "SET updateTime=#{updateTime}" +
  110 + "<if test=\"name != null\">, name=#{name}</if>" +
  111 + "<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" +
  112 + "<if test=\"model != null\">, model=#{model}</if>" +
  113 + "<if test=\"firmware != null\">, firmware=#{firmware}</if>" +
  114 + "<if test=\"transport != null\">, transport=#{transport}</if>" +
  115 + "<if test=\"ip != null\">, ip=#{ip}</if>" +
  116 + "<if test=\"localIp != null\">, localIp=#{localIp}</if>" +
  117 + "<if test=\"port != null\">, port=#{port}</if>" +
  118 + "<if test=\"hostAddress != null\">, hostAddress=#{hostAddress}</if>" +
  119 + "<if test=\"online != null\">, online=#{online}</if>" +
  120 + "<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" +
  121 + "<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" +
  122 + "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" +
  123 + "<if test=\"expires != null\">, expires=#{expires}</if>" +
  124 + "WHERE deviceId=#{deviceId}"+
125 " </script>"}) 125 " </script>"})
126 int update(Device device); 126 int update(Device device);
127 127
@@ -225,28 +225,28 @@ public interface DeviceMapper { @@ -225,28 +225,28 @@ public interface DeviceMapper {
225 "geoCoordSys," + 225 "geoCoordSys," +
226 "treeType," + 226 "treeType," +
227 "online" + 227 "online" +
228 - " FROM device WHERE ip = #{host} AND port=${port}") 228 + " FROM device WHERE ip = #{host} AND port=#{port}")
229 Device getDeviceByHostAndPort(String host, int port); 229 Device getDeviceByHostAndPort(String host, int port);
230 230
231 @Update(value = {" <script>" + 231 @Update(value = {" <script>" +
232 "UPDATE device " + 232 "UPDATE device " +
233 - "SET updateTime='${updateTime}'" +  
234 - "<if test=\"name != null\">, custom_name='${name}'</if>" +  
235 - "<if test=\"password != null\">, password='${password}'</if>" +  
236 - "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +  
237 - "<if test=\"ip != null\">, ip='${ip}'</if>" +  
238 - "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +  
239 - "<if test=\"port != null\">, port=${port}</if>" +  
240 - "<if test=\"charset != null\">, charset='${charset}'</if>" +  
241 - "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +  
242 - "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" +  
243 - "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" +  
244 - "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +  
245 - "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" + 233 + "SET updateTime=#{updateTime}" +
  234 + "<if test=\"name != null\">, custom_name=#{name}</if>" +
  235 + "<if test=\"password != null\">, password=#{password}</if>" +
  236 + "<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" +
  237 + "<if test=\"ip != null\">, ip=#{ip}</if>" +
  238 + "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
  239 + "<if test=\"port != null\">, port=#{port}</if>" +
  240 + "<if test=\"charset != null\">, charset=#{charset}</if>" +
  241 + "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" +
  242 + "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=#{subscribeCycleForMobilePosition}</if>" +
  243 + "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" +
  244 + "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" +
  245 + "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" +
246 "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + 246 "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
247 "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + 247 "<if test=\"treeType != null\">, treeType=#{treeType}</if>" +
248 "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + 248 "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
249 - "WHERE deviceId='${deviceId}'"+ 249 + "WHERE deviceId=#{deviceId}"+
250 " </script>"}) 250 " </script>"})
251 int updateCustom(Device device); 251 int updateCustom(Device device);
252 252
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.*; @@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.*;
9 public interface DeviceMobilePositionMapper { 9 public interface DeviceMobilePositionMapper {
10 10
11 @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + 11 @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " +
12 - "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')") 12 + "VALUES (#{deviceId},#{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})")
13 int insertNewPosition(MobilePosition mobilePosition); 13 int insertNewPosition(MobilePosition mobilePosition);
14 14
15 @Select(value = {" <script>" + 15 @Select(value = {" <script>" +
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -16,9 +16,9 @@ public interface GbStreamMapper { @@ -16,9 +16,9 @@ public interface GbStreamMapper {
16 16
17 @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + 17 @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +
18 "longitude, latitude, streamType, mediaServerId, createTime) VALUES" + 18 "longitude, latitude, streamType, mediaServerId, createTime) VALUES" +
19 - "('${app}', '${stream}', '${gbId}', '${name}', " +  
20 - "'${longitude}', '${latitude}', '${streamType}', " +  
21 - "'${mediaServerId}', '${createTime}')") 19 + "(#{app}, #{stream}, #{gbId}, #{name}, " +
  20 + "#{longitude}, #{latitude}, #{streamType}, " +
  21 + "#{mediaServerId}, #{createTime})")
22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") 22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
23 int add(GbStream gbStream); 23 int add(GbStream gbStream);
24 24
@@ -57,7 +57,7 @@ public interface GbStreamMapper { @@ -57,7 +57,7 @@ public interface GbStreamMapper {
57 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " + 57 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " +
58 " <if test='catalogId == null'> AND gs.gbStreamId not in" + 58 " <if test='catalogId == null'> AND gs.gbStreamId not in" +
59 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " + 59 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " +
60 - " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + 60 + " <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
61 " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" + 61 " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +
62 " order by gs.gbStreamId asc " + 62 " order by gs.gbStreamId asc " +
63 "</script>") 63 "</script>")
@@ -71,7 +71,7 @@ public interface GbStreamMapper { @@ -71,7 +71,7 @@ public interface GbStreamMapper {
71 71
72 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + 72 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +
73 "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + 73 "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " +
74 - "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") 74 + "WHERE gs.gbId = #{gbId} AND pgs.platformId = #{platformId}")
75 GbStream queryStreamInPlatform(String platformId, String gbId); 75 GbStream queryStreamInPlatform(String platformId, String gbId);
76 76
77 @Select("<script> "+ 77 @Select("<script> "+
@@ -122,9 +122,9 @@ public interface GbStreamMapper { @@ -122,9 +122,9 @@ public interface GbStreamMapper {
122 "longitude, latitude, streamType, mediaServerId, createTime)" + 122 "longitude, latitude, streamType, mediaServerId, createTime)" +
123 "values " + 123 "values " +
124 "<foreach collection='subList' index='index' item='item' separator=','> " + 124 "<foreach collection='subList' index='index' item='item' separator=','> " +
125 - "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +  
126 - "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +  
127 - "'${item.mediaServerId}', '${item.createTime}') "+ 125 + "(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " +
  126 + "#{item.longitude}, #{item.latitude}, #{item.streamType}, " +
  127 + "#{item.mediaServerId}, #{item.createTime}) "+
128 "</foreach> " + 128 "</foreach> " +
129 "</script>") 129 "</script>")
130 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") 130 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
@@ -134,7 +134,7 @@ public interface GbStreamMapper { @@ -134,7 +134,7 @@ public interface GbStreamMapper {
134 "<foreach collection='gpsMsgInfos' item='item' separator=';'>" + 134 "<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
135 " UPDATE" + 135 " UPDATE" +
136 " gb_stream" + 136 " gb_stream" +
137 - " SET longitude=${item.lng}, latitude=${item.lat} " + 137 + " SET longitude=#{item.lng}, latitude=#{item.lat} " +
138 "WHERE gbId=#{item.id}"+ 138 "WHERE gbId=#{item.id}"+
139 "</foreach>" + 139 "</foreach>" +
140 "</script>"}) 140 "</script>"})
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
@@ -18,16 +18,16 @@ import java.util.List; @@ -18,16 +18,16 @@ import java.util.List;
18 public interface LogMapper { 18 public interface LogMapper {
19 19
20 @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " + 20 @Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " +
21 - "values ('${name}', '${type}', '${uri}', '${address}', '${result}', ${timing}, '${username}', '${createTime}')") 21 + "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})")
22 int add(LogDto logDto); 22 int add(LogDto logDto);
23 23
24 @Select(value = {"<script>" + 24 @Select(value = {"<script>" +
25 " SELECT * FROM log " + 25 " SELECT * FROM log " +
26 " WHERE 1=1 " + 26 " WHERE 1=1 " +
27 - " <if test=\"query != null\"> AND (name LIKE '%${query}%')</if> " +  
28 - " <if test=\"type != null\" > AND type = '${type}'</if>" +  
29 - " <if test=\"startTime != null\" > AND createTime &gt;= '${startTime}' </if>" +  
30 - " <if test=\"endTime != null\" > AND createTime &lt;= '${endTime}' </if>" + 27 + " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
  28 + " <if test=\"type != null\" > AND type = #{type}</if>" +
  29 + " <if test=\"startTime != null\" > AND createTime &gt;= #{startTime} </if>" +
  30 + " <if test=\"endTime != null\" > AND createTime &lt;= #{endTime} </if>" +
31 " ORDER BY createTime DESC " + 31 " ORDER BY createTime DESC " +
32 " </script>"}) 32 " </script>"})
33 List<LogDto> query(String query, String type, String startTime, String endTime); 33 List<LogDto> query(String query, String type, String startTime, String endTime);
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
@@ -35,92 +35,92 @@ public interface MediaServerMapper { @@ -35,92 +35,92 @@ public interface MediaServerMapper {
35 "hookAliveInterval" + 35 "hookAliveInterval" +
36 ") VALUES " + 36 ") VALUES " +
37 "(" + 37 "(" +
38 - "'${id}', " +  
39 - "'${ip}', " +  
40 - "'${hookIp}', " +  
41 - "'${sdpIp}', " +  
42 - "'${streamIp}', " +  
43 - "${httpPort}, " +  
44 - "${httpSSlPort}, " +  
45 - "${rtmpPort}, " +  
46 - "${rtmpSSlPort}, " +  
47 - "${rtpProxyPort}, " +  
48 - "${rtspPort}, " +  
49 - "${rtspSSLPort}, " +  
50 - "${autoConfig}, " +  
51 - "'${secret}', " +  
52 - "${rtpEnable}, " +  
53 - "'${rtpPortRange}', " +  
54 - "${recordAssistPort}, " +  
55 - "${defaultServer}, " +  
56 - "'${createTime}', " +  
57 - "'${updateTime}', " +  
58 - "${hookAliveInterval})") 38 + "#{id}, " +
  39 + "#{ip}, " +
  40 + "#{hookIp}, " +
  41 + "#{sdpIp}, " +
  42 + "#{streamIp}, " +
  43 + "#{httpPort}, " +
  44 + "#{httpSSlPort}, " +
  45 + "#{rtmpPort}, " +
  46 + "#{rtmpSSlPort}, " +
  47 + "#{rtpProxyPort}, " +
  48 + "#{rtspPort}, " +
  49 + "#{rtspSSLPort}, " +
  50 + "#{autoConfig}, " +
  51 + "#{secret}, " +
  52 + "#{rtpEnable}, " +
  53 + "#{rtpPortRange}, " +
  54 + "#{recordAssistPort}, " +
  55 + "#{defaultServer}, " +
  56 + "#{createTime}, " +
  57 + "#{updateTime}, " +
  58 + "#{hookAliveInterval})")
59 int add(MediaServerItem mediaServerItem); 59 int add(MediaServerItem mediaServerItem);
60 60
61 @Update(value = {" <script>" + 61 @Update(value = {" <script>" +
62 "UPDATE media_server " + 62 "UPDATE media_server " +
63 - "SET updateTime='${updateTime}'" +  
64 - "<if test=\"ip != null\">, ip='${ip}'</if>" +  
65 - "<if test=\"hookIp != null\">, hookIp='${hookIp}'</if>" +  
66 - "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +  
67 - "<if test=\"streamIp != null\">, streamIp='${streamIp}'</if>" +  
68 - "<if test=\"httpPort != null\">, httpPort=${httpPort}</if>" +  
69 - "<if test=\"httpSSlPort != null\">, httpSSlPort=${httpSSlPort}</if>" +  
70 - "<if test=\"rtmpPort != null\">, rtmpPort=${rtmpPort}</if>" +  
71 - "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=${rtmpSSlPort}</if>" +  
72 - "<if test=\"rtpProxyPort != null\">, rtpProxyPort=${rtpProxyPort}</if>" +  
73 - "<if test=\"rtspPort != null\">, rtspPort=${rtspPort}</if>" +  
74 - "<if test=\"rtspSSLPort != null\">, rtspSSLPort=${rtspSSLPort}</if>" +  
75 - "<if test=\"autoConfig != null\">, autoConfig=${autoConfig}</if>" +  
76 - "<if test=\"rtpEnable != null\">, rtpEnable=${rtpEnable}</if>" +  
77 - "<if test=\"rtpPortRange != null\">, rtpPortRange='${rtpPortRange}'</if>" +  
78 - "<if test=\"secret != null\">, secret='${secret}'</if>" +  
79 - "<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +  
80 - "<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +  
81 - "WHERE id='${id}'"+ 63 + "SET updateTime=#{updateTime}" +
  64 + "<if test=\"ip != null\">, ip=#{ip}</if>" +
  65 + "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +
  66 + "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
  67 + "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +
  68 + "<if test=\"httpPort != null\">, httpPort=#{httpPort}</if>" +
  69 + "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +
  70 + "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +
  71 + "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +
  72 + "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +
  73 + "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +
  74 + "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +
  75 + "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +
  76 + "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +
  77 + "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" +
  78 + "<if test=\"secret != null\">, secret=#{secret}</if>" +
  79 + "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +
  80 + "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" +
  81 + "WHERE id=#{id}"+
82 " </script>"}) 82 " </script>"})
83 int update(MediaServerItem mediaServerItem); 83 int update(MediaServerItem mediaServerItem);
84 84
85 @Update(value = {" <script>" + 85 @Update(value = {" <script>" +
86 "UPDATE media_server " + 86 "UPDATE media_server " +
87 - "SET updateTime='${updateTime}'" +  
88 - "<if test=\"id != null\">, id='${id}'</if>" +  
89 - "<if test=\"hookIp != null\">, hookIp='${hookIp}'</if>" +  
90 - "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +  
91 - "<if test=\"streamIp != null\">, streamIp='${streamIp}'</if>" +  
92 - "<if test=\"httpSSlPort != null\">, httpSSlPort=${httpSSlPort}</if>" +  
93 - "<if test=\"rtmpPort != null\">, rtmpPort=${rtmpPort}</if>" +  
94 - "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=${rtmpSSlPort}</if>" +  
95 - "<if test=\"rtpProxyPort != null\">, rtpProxyPort=${rtpProxyPort}</if>" +  
96 - "<if test=\"rtspPort != null\">, rtspPort=${rtspPort}</if>" +  
97 - "<if test=\"rtspSSLPort != null\">, rtspSSLPort=${rtspSSLPort}</if>" +  
98 - "<if test=\"autoConfig != null\">, autoConfig=${autoConfig}</if>" +  
99 - "<if test=\"rtpEnable != null\">, rtpEnable=${rtpEnable}</if>" +  
100 - "<if test=\"rtpPortRange != null\">, rtpPortRange='${rtpPortRange}'</if>" +  
101 - "<if test=\"secret != null\">, secret='${secret}'</if>" +  
102 - "<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +  
103 - "<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +  
104 - "WHERE ip='${ip}' and httpPort=${httpPort}"+ 87 + "SET updateTime=#{updateTime}" +
  88 + "<if test=\"id != null\">, id=#{id}</if>" +
  89 + "<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +
  90 + "<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
  91 + "<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +
  92 + "<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +
  93 + "<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +
  94 + "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +
  95 + "<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +
  96 + "<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +
  97 + "<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +
  98 + "<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +
  99 + "<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +
  100 + "<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" +
  101 + "<if test=\"secret != null\">, secret=#{secret}</if>" +
  102 + "<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +
  103 + "<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" +
  104 + "WHERE ip=#{ip} and httpPort=#{httpPort}"+
105 " </script>"}) 105 " </script>"})
106 int updateByHostAndPort(MediaServerItem mediaServerItem); 106 int updateByHostAndPort(MediaServerItem mediaServerItem);
107 107
108 - @Select("SELECT * FROM media_server WHERE id='${id}'") 108 + @Select("SELECT * FROM media_server WHERE id=#{id}")
109 MediaServerItem queryOne(String id); 109 MediaServerItem queryOne(String id);
110 110
111 @Select("SELECT * FROM media_server") 111 @Select("SELECT * FROM media_server")
112 List<MediaServerItem> queryAll(); 112 List<MediaServerItem> queryAll();
113 113
114 - @Delete("DELETE FROM media_server WHERE id='${id}'") 114 + @Delete("DELETE FROM media_server WHERE id=#{id}")
115 void delOne(String id); 115 void delOne(String id);
116 116
117 - @Select("DELETE FROM media_server WHERE ip='${host}' and httpPort=${port}") 117 + @Select("DELETE FROM media_server WHERE ip=#{host} and httpPort=#{port}")
118 void delOneByIPAndPort(String host, int port); 118 void delOneByIPAndPort(String host, int port);
119 119
120 @Delete("DELETE FROM media_server WHERE defaultServer=1") 120 @Delete("DELETE FROM media_server WHERE defaultServer=1")
121 int delDefault(); 121 int delDefault();
122 122
123 - @Select("SELECT * FROM media_server WHERE ip='${host}' and httpPort=${port}") 123 + @Select("SELECT * FROM media_server WHERE ip=#{host} and httpPort=#{port}")
124 MediaServerItem queryOneByHostAndPort(String host, int port); 124 MediaServerItem queryOneByHostAndPort(String host, int port);
125 125
126 @Select("SELECT * FROM media_server WHERE defaultServer=1") 126 @Select("SELECT * FROM media_server WHERE defaultServer=1")
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -17,9 +17,9 @@ public interface ParentPlatformMapper { @@ -17,9 +17,9 @@ public interface ParentPlatformMapper {
17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + 17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
18 " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + 18 " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
19 " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + 19 " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " +
20 - " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +  
21 - " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +  
22 - " ${status}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") 20 + " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
  21 + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, " +
  22 + " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
23 int addParentPlatform(ParentPlatform parentPlatform); 23 int addParentPlatform(ParentPlatform parentPlatform);
24 24
25 @Update("UPDATE parent_platform " + 25 @Update("UPDATE parent_platform " +
@@ -41,7 +41,7 @@ public interface ParentPlatformMapper { @@ -41,7 +41,7 @@ public interface ParentPlatformMapper {
41 "ptz=#{ptz}, " + 41 "ptz=#{ptz}, " +
42 "rtcp=#{rtcp}, " + 42 "rtcp=#{rtcp}, " +
43 "status=#{status}, " + 43 "status=#{status}, " +
44 - "startOfflinePush=${startOfflinePush}, " + 44 + "startOfflinePush=#{startOfflinePush}, " +
45 "catalogGroup=#{catalogGroup}, " + 45 "catalogGroup=#{catalogGroup}, " +
46 "administrativeDivision=#{administrativeDivision}, " + 46 "administrativeDivision=#{administrativeDivision}, " +
47 "createTime=#{createTime}, " + 47 "createTime=#{createTime}, " +
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -21,22 +21,22 @@ public interface PlatformChannelMapper { @@ -21,22 +21,22 @@ public interface PlatformChannelMapper {
21 * 查询列表里已经关联的 21 * 查询列表里已经关联的
22 */ 22 */
23 @Select("<script> "+ 23 @Select("<script> "+
24 - "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +  
25 - "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> '${item.id}'</foreach>" + 24 + "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" +
  25 + "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
26 "</script>") 26 "</script>")
27 List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); 27 List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
28 28
29 @Insert("<script> "+ 29 @Insert("<script> "+
30 "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" + 30 "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" +
31 "<foreach collection='channelReducesToAdd' item='item' separator=','>" + 31 "<foreach collection='channelReducesToAdd' item='item' separator=','>" +
32 - " ('${platformId}', '${item.id}' , '${item.catalogId}' )" + 32 + " (#{platformId}, #{item.id} , #{item.catalogId} )" +
33 "</foreach>" + 33 "</foreach>" +
34 "</script>") 34 "</script>")
35 int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); 35 int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
36 36
37 @Delete("<script> "+ 37 @Delete("<script> "+
38 - "DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +  
39 - "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > '${item.id}'</foreach>" + 38 + "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" +
  39 + "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
40 "</script>") 40 "</script>")
41 int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); 41 int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
42 42
@@ -50,14 +50,14 @@ public interface PlatformChannelMapper { @@ -50,14 +50,14 @@ public interface PlatformChannelMapper {
50 int delChannelForDeviceId(String deviceId); 50 int delChannelForDeviceId(String deviceId);
51 51
52 @Delete("<script> "+ 52 @Delete("<script> "+
53 - "DELETE FROM platform_gb_channel WHERE platformId='${platformId}'" + 53 + "DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" +
54 "</script>") 54 "</script>")
55 int cleanChannelForGB(String platformId); 55 int cleanChannelForGB(String platformId);
56 56
57 - @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}'") 57 + @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}")
58 List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); 58 List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
59 59
60 - @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}") 60 + @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}")
61 List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); 61 List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
62 62
63 @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + 63 @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -26,7 +26,7 @@ public interface PlatformGbStreamMapper { @@ -26,7 +26,7 @@ public interface PlatformGbStreamMapper {
26 "(gbStreamId, platformId, catalogId) " + 26 "(gbStreamId, platformId, catalogId) " +
27 "values " + 27 "values " +
28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + 28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
29 - "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" + 29 + "(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" +
30 "</foreach> " + 30 "</foreach> " +
31 "</script>") 31 "</script>")
32 int batchAdd(List<StreamPushItem> streamPushItems); 32 int batchAdd(List<StreamPushItem> streamPushItems);
src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java
@@ -14,10 +14,10 @@ import java.util.List; @@ -14,10 +14,10 @@ import java.util.List;
14 public interface RecordInfoDao { 14 public interface RecordInfoDao {
15 15
16 @Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" + 16 @Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" +
17 - "('${app}', '${stream}', '${mediaServerId}', datetime('now','localtime')), '${type}', '${deviceId}', '${channelId}', '${name}'") 17 + "(#{app}, #{stream}, #{mediaServerId}, datetime('now','localtime')), #{type}, #{deviceId}, #{channelId}, #{name}")
18 int add(RecordInfo recordInfo); 18 int add(RecordInfo recordInfo);
19 19
20 - @Delete("DELETE FROM user WHERE createTime < '${beforeTime}'") 20 + @Delete("DELETE FROM user WHERE createTime < #{beforeTime}")
21 int deleteBefore(String beforeTime); 21 int deleteBefore(String beforeTime);
22 22
23 @Select("select * FROM recordInfo") 23 @Select("select * FROM recordInfo")
src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
@@ -12,14 +12,14 @@ import java.util.List; @@ -12,14 +12,14 @@ import java.util.List;
12 public interface RoleMapper { 12 public interface RoleMapper {
13 13
14 @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + 14 @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" +
15 - "('${name}', '${authority}', '${createTime}', '${updateTime}')") 15 + "(#{name}, #{authority}, #{createTime}, #{updateTime})")
16 int add(Role role); 16 int add(Role role);
17 17
18 @Update(value = {" <script>" + 18 @Update(value = {" <script>" +
19 "UPDATE user_role " + 19 "UPDATE user_role " +
20 - "SET updateTime='${updateTime}' " +  
21 - "<if test=\"name != null\">, name='${name}'</if>" +  
22 - "<if test=\"authority != null\">, authority='${authority}'</if>" + 20 + "SET updateTime=#{updateTime} " +
  21 + "<if test=\"name != null\">, name=#{name}</if>" +
  22 + "<if test=\"authority != null\">, authority=#{authority}</if>" +
23 "WHERE id != 1 and id=#{id}" + 23 "WHERE id != 1 and id=#{id}" +
24 " </script>"}) 24 " </script>"})
25 int update(Role role); 25 int update(Role role);
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
@@ -13,9 +13,9 @@ public interface StreamProxyMapper { @@ -13,9 +13,9 @@ public interface StreamProxyMapper {
13 13
14 @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " + 14 @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " +
15 "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" + 15 "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" +
16 - "('${type}','${name}', '${app}', '${stream}', '${mediaServerId}','${url}', '${src_url}', '${dst_url}', " +  
17 - "'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_audio}, ${enable_mp4}, ${enable}, ${status}, " +  
18 - "${enable_remove_none_reader}, ${enable_disable_none_reader}, '${createTime}' )") 16 + "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " +
  17 + "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " +
  18 + "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )")
19 int add(StreamProxyItem streamProxyDto); 19 int add(StreamProxyItem streamProxyDto);
20 20
21 @Update("UPDATE stream_proxy " + 21 @Update("UPDATE stream_proxy " +
@@ -45,7 +45,7 @@ public interface StreamProxyMapper { @@ -45,7 +45,7 @@ public interface StreamProxyMapper {
45 @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") 45 @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")
46 List<StreamProxyItem> selectAll(); 46 List<StreamProxyItem> selectAll();
47 47
48 - @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") 48 + @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")
49 List<StreamProxyItem> selectForEnable(boolean enable); 49 List<StreamProxyItem> selectForEnable(boolean enable);
50 50
51 @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") 51 @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 { @@ -53,12 +53,12 @@ public interface StreamProxyMapper {
53 53
54 @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + 54 @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " +
55 "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + 55 "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
56 - "WHERE st.enable=${enable} and st.mediaServerId = #{id} order by st.createTime desc") 56 + "WHERE st.enable=#{enable} and st.mediaServerId = #{id} order by st.createTime desc")
57 List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable); 57 List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable);
58 58
59 @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + 59 @Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " +
60 "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + 60 "LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
61 - "WHERE st.mediaServerId = '${id}' order by st.createTime desc") 61 + "WHERE st.mediaServerId = #{id} order by st.createTime desc")
62 List<StreamProxyItem> selectInMediaServer(String id); 62 List<StreamProxyItem> selectInMediaServer(String id);
63 63
64 @Update("UPDATE stream_proxy " + 64 @Update("UPDATE stream_proxy " +
@@ -67,7 +67,7 @@ public interface StreamProxyMapper { @@ -67,7 +67,7 @@ public interface StreamProxyMapper {
67 void updateStatusByMediaServerId(String mediaServerId, boolean status); 67 void updateStatusByMediaServerId(String mediaServerId, boolean status);
68 68
69 @Update("UPDATE stream_proxy " + 69 @Update("UPDATE stream_proxy " +
70 - "SET status=${status} " + 70 + "SET status=#{status} " +
71 "WHERE app=#{app} AND stream=#{stream}") 71 "WHERE app=#{app} AND stream=#{stream}")
72 int updateStatus(String app, String stream, boolean status); 72 int updateStatus(String app, String stream, boolean status);
73 73
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -17,23 +17,23 @@ public interface StreamPushMapper { @@ -17,23 +17,23 @@ public interface StreamPushMapper {
17 17
18 @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + 18 @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
19 "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + 19 "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" +
20 - "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +  
21 - "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', " +  
22 - "${pushIng}, ${self} )") 20 + "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " +
  21 + "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " +
  22 + "#{pushIng}, #{self} )")
23 int add(StreamPushItem streamPushItem); 23 int add(StreamPushItem streamPushItem);
24 24
25 25
26 @Update(value = {" <script>" + 26 @Update(value = {" <script>" +
27 "UPDATE stream_push " + 27 "UPDATE stream_push " +
28 - "SET updateTime='${updateTime}'" +  
29 - "<if test=\"mediaServerId != null\">, mediaServerId='${mediaServerId}'</if>" +  
30 - "<if test=\"totalReaderCount != null\">, totalReaderCount='${totalReaderCount}'</if>" +  
31 - "<if test=\"originType != null\">, originType=${originType}</if>" +  
32 - "<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" +  
33 - "<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" +  
34 - "<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" +  
35 - "<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" +  
36 - "<if test=\"self != null\">, self=${self}</if>" + 28 + "SET updateTime=#{updateTime}" +
  29 + "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
  30 + "<if test=\"totalReaderCount != null\">, totalReaderCount=#{totalReaderCount}</if>" +
  31 + "<if test=\"originType != null\">, originType=#{originType}</if>" +
  32 + "<if test=\"originTypeStr != null\">, originTypeStr=#{originTypeStr}</if>" +
  33 + "<if test=\"pushTime != null\">, pushTime=#{pushTime}</if>" +
  34 + "<if test=\"aliveSecond != null\">, aliveSecond=#{aliveSecond}</if>" +
  35 + "<if test=\"pushIng != null\">, pushIng=#{pushIng}</if>" +
  36 + "<if test=\"self != null\">, self=#{self}</if>" +
37 "WHERE app=#{app} AND stream=#{stream}"+ 37 "WHERE app=#{app} AND stream=#{stream}"+
38 " </script>"}) 38 " </script>"})
39 int update(StreamPushItem streamPushItem); 39 int update(StreamPushItem streamPushItem);
@@ -76,7 +76,7 @@ public interface StreamPushMapper { @@ -76,7 +76,7 @@ public interface StreamPushMapper {
76 "on st.app = gs.app AND st.stream = gs.stream " + 76 "on st.app = gs.app AND st.stream = gs.stream " +
77 "WHERE " + 77 "WHERE " +
78 "1=1 " + 78 "1=1 " +
79 - " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + 79 + " <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
80 " <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" + 80 " <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" +
81 " <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" + 81 " <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" +
82 " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + 82 " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
@@ -94,9 +94,9 @@ public interface StreamPushMapper { @@ -94,9 +94,9 @@ public interface StreamPushMapper {
94 "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + 94 "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
95 "createTime, aliveSecond, mediaServerId, status, pushIng) " + 95 "createTime, aliveSecond, mediaServerId, status, pushIng) " +
96 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + 96 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
97 - "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " +  
98 - "'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}', ${item.status} ," +  
99 - " ${item.pushIng} )" + 97 + "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " +
  98 + "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," +
  99 + " #{item.pushIng} )" +
100 " </foreach>" + 100 " </foreach>" +
101 "</script>") 101 "</script>")
102 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") 102 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@@ -115,12 +115,12 @@ public interface StreamPushMapper { @@ -115,12 +115,12 @@ public interface StreamPushMapper {
115 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); 115 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
116 116
117 @Update("UPDATE stream_push " + 117 @Update("UPDATE stream_push " +
118 - "SET status=${status} " + 118 + "SET status=#{status} " +
119 "WHERE app=#{app} AND stream=#{stream}") 119 "WHERE app=#{app} AND stream=#{stream}")
120 int updateStatus(String app, String stream, boolean status); 120 int updateStatus(String app, String stream, boolean status);
121 121
122 @Update("UPDATE stream_push " + 122 @Update("UPDATE stream_push " +
123 - "SET pushIng=${pushIng} " + 123 + "SET pushIng=#{pushIng} " +
124 "WHERE app=#{app} AND stream=#{stream}") 124 "WHERE app=#{app} AND stream=#{stream}")
125 int updatePushStatus(String app, String stream, boolean pushIng); 125 int updatePushStatus(String app, String stream, boolean pushIng);
126 126
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
@@ -11,16 +11,16 @@ import java.util.List; @@ -11,16 +11,16 @@ import java.util.List;
11 public interface UserMapper { 11 public interface UserMapper {
12 12
13 @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + 13 @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" +
14 - "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')") 14 + "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})")
15 int add(User user); 15 int add(User user);
16 16
17 @Update(value = {" <script>" + 17 @Update(value = {" <script>" +
18 "UPDATE user " + 18 "UPDATE user " +
19 - "SET updateTime='${updateTime}' " +  
20 - "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +  
21 - "<if test=\"role != null\">, roleId='${role.id}'</if>" +  
22 - "<if test=\"password != null\">, password='${password}'</if>" +  
23 - "<if test=\"username != null\">, username='${username}'</if>" + 19 + "SET updateTime=#{updateTime} " +
  20 + "<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" +
  21 + "<if test=\"role != null\">, roleId=#{role.id}</if>" +
  22 + "<if test=\"password != null\">, password=#{password}</if>" +
  23 + "<if test=\"username != null\">, username=#{username}</if>" +
24 "WHERE id=#{id}" + 24 "WHERE id=#{id}" +
25 " </script>"}) 25 " </script>"})
26 int update(User user); 26 int update(User user);
@@ -50,10 +50,10 @@ public interface UserMapper { @@ -50,10 +50,10 @@ public interface UserMapper {
50 @ResultMap(value="roleMap") 50 @ResultMap(value="roleMap")
51 List<User> selectAll(); 51 List<User> selectAll();
52 52
53 - @Select("select * from (select user.*, concat('${callId}_', pushKey) as str1 from user) as u where md5(u.str1) = '${sign}'") 53 + @Select("select * from (select user.*, concat(#{callId}_', pushKey) as str1 from user) as u where md5(u.str1) = #{sign}")
54 List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign); 54 List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
55 55
56 - @Select("select * from user where md5(pushKey) = '${sign}'") 56 + @Select("select * from user where md5(pushKey) = #{sign}")
57 List<User> checkPushAuthorityByCallId(String sign); 57 List<User> checkPushAuthorityByCallId(String sign);
58 58
59 @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") 59 @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")