使用#替代$,防止SQL注入的风险(主要防止模糊查询sql部分的注入)。

This commit is contained in:
xubinbin 2022-12-28 13:26:33 +08:00
parent 09bfc69f07
commit 7b601a3e8f
15 changed files with 255 additions and 255 deletions

View File

@ -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 = {" <script>" +
" SELECT * FROM device_alarm " +
" WHERE 1=1 " +
" <if test=\"deviceId != null\" > AND deviceId = '${deviceId}'</if>" +
" <if test=\"alarmPriority != null\" > AND alarmPriority = '${alarmPriority}' </if>" +
" <if test=\"alarmMethod != null\" > AND alarmMethod = '${alarmMethod}' </if>" +
" <if test=\"alarmType != null\" > AND alarmType = '${alarmType}' </if>" +
" <if test=\"startTime != null\" > AND alarmTime &gt;= '${startTime}' </if>" +
" <if test=\"endTime != null\" > AND alarmTime &lt;= '${endTime}' </if>" +
" <if test=\"deviceId != null\" > AND deviceId = #{deviceId}</if>" +
" <if test=\"alarmPriority != null\" > AND alarmPriority = #{alarmPriority} </if>" +
" <if test=\"alarmMethod != null\" > AND alarmMethod = #{alarmMethod} </if>" +
" <if test=\"alarmType != null\" > AND alarmType = #{alarmType} </if>" +
" <if test=\"startTime != null\" > AND alarmTime &gt;= #{startTime} </if>" +
" <if test=\"endTime != null\" > AND alarmTime &lt;= #{endTime} </if>" +
" ORDER BY alarmTime ASC " +
" </script>"})
List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
@ -38,10 +38,10 @@ public interface DeviceAlarmMapper {
@Delete(" <script>" +
"DELETE FROM device_alarm WHERE 1=1 " +
" <if test=\"deviceIdList != null and id == null \" > AND deviceId in " +
"<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > '${item}'</foreach>" +
"<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</if>" +
" <if test=\"time != null and id == null \" > AND alarmTime &lt;= '${time}'</if>" +
" <if test=\"id != null\" > AND id = ${id}</if>" +
" <if test=\"time != null and id == null \" > AND alarmTime &lt;= #{time}</if>" +
" <if test=\"id != null\" > AND id = #{id}</if>" +
" </script>"
)
int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time);

View File

@ -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 = {" <script>" +
"UPDATE device_channel " +
"SET updateTime='${updateTime}'" +
"<if test='name != null'>, name='${name}'</if>" +
"<if test='manufacture != null'>, manufacture='${manufacture}'</if>" +
"<if test='model != null'>, model='${model}'</if>" +
"<if test='owner != null'>, owner='${owner}'</if>" +
"<if test='civilCode != null'>, civilCode='${civilCode}'</if>" +
"<if test='block != null'>, block='${block}'</if>" +
"<if test='address != null'>, address='${address}'</if>" +
"<if test='parental != null'>, parental=${parental}</if>" +
"<if test='parentId != null'>, parentId='${parentId}'</if>" +
"<if test='safetyWay != null'>, safetyWay=${safetyWay}</if>" +
"<if test='registerWay != null'>, registerWay=${registerWay}</if>" +
"<if test='certNum != null'>, certNum='${certNum}'</if>" +
"<if test='certifiable != null'>, certifiable=${certifiable}</if>" +
"<if test='errCode != null'>, errCode=${errCode}</if>" +
"<if test='secrecy != null'>, secrecy='${secrecy}'</if>" +
"<if test='ipAddress != null'>, ipAddress='${ipAddress}'</if>" +
"<if test='port != null'>, port=${port}</if>" +
"<if test='password != null'>, password='${password}'</if>" +
"<if test='PTZType != null'>, PTZType=${PTZType}</if>" +
"<if test='status != null'>, status='${status}'</if>" +
"<if test='streamId != null'>, streamId='${streamId}'</if>" +
"<if test='hasAudio != null'>, hasAudio=${hasAudio}</if>" +
"<if test='longitude != null'>, longitude=${longitude}</if>" +
"<if test='latitude != null'>, latitude=${latitude}</if>" +
"<if test='longitudeGcj02 != null'>, longitudeGcj02=${longitudeGcj02}</if>" +
"<if test='latitudeGcj02 != null'>, latitudeGcj02=${latitudeGcj02}</if>" +
"<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
"<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
"SET updateTime=#{updateTime}" +
"<if test='name != null'>, name=#{name}</if>" +
"<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
"<if test='model != null'>, model=#{model}</if>" +
"<if test='owner != null'>, owner=#{owner}</if>" +
"<if test='civilCode != null'>, civilCode=#{civilCode}</if>" +
"<if test='block != null'>, block=#{block}</if>" +
"<if test='address != null'>, address=#{address}</if>" +
"<if test='parental != null'>, parental=#{parental}</if>" +
"<if test='parentId != null'>, parentId=#{parentId}</if>" +
"<if test='safetyWay != null'>, safetyWay=#{safetyWay}</if>" +
"<if test='registerWay != null'>, registerWay=#{registerWay}</if>" +
"<if test='certNum != null'>, certNum=#{certNum}</if>" +
"<if test='certifiable != null'>, certifiable=#{certifiable}</if>" +
"<if test='errCode != null'>, errCode=#{errCode}</if>" +
"<if test='secrecy != null'>, secrecy=#{secrecy}</if>" +
"<if test='ipAddress != null'>, ipAddress=#{ipAddress}</if>" +
"<if test='port != null'>, port=#{port}</if>" +
"<if test='password != null'>, password=#{password}</if>" +
"<if test='PTZType != null'>, PTZType=#{PTZType}</if>" +
"<if test='status != null'>, status=#{status}</if>" +
"<if test='streamId != null'>, streamId=#{streamId}</if>" +
"<if test='hasAudio != null'>, hasAudio=#{hasAudio}</if>" +
"<if test='longitude != null'>, longitude=#{longitude}</if>" +
"<if test='latitude != null'>, latitude=#{latitude}</if>" +
"<if test='longitudeGcj02 != null'>, longitudeGcj02=#{longitudeGcj02}</if>" +
"<if test='latitudeGcj02 != null'>, latitudeGcj02=#{latitudeGcj02}</if>" +
"<if test='longitudeWgs84 != null'>, longitudeWgs84=#{longitudeWgs84}</if>" +
"<if test='latitudeWgs84 != null'>, latitudeWgs84=#{latitudeWgs84}</if>" +
"<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
"<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
"WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
"WHERE deviceId=#{deviceId} AND channelId=#{channelId}"+
" </script>"})
int update(DeviceChannel channel);
@ -70,7 +70,7 @@ public interface DeviceChannelMapper {
"device_channel dc " +
"WHERE " +
"dc.deviceId = #{deviceId} " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status=1</if>" +
" <if test='online == false' > AND dc.status=0</if>" +
@ -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 " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='online == true' > AND dc.status=1</if> " +
" <if test='online == false' > AND dc.status=0</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " +
@ -151,14 +151,14 @@ public interface DeviceChannelMapper {
" longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"('${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}) " +
"</foreach> " +
"ON DUPLICATE KEY UPDATE " +
"updateTime=VALUES(updateTime), " +
@ -203,39 +203,39 @@ public interface DeviceChannelMapper {
"<foreach collection='updateChannels' item='item' separator=';'>" +
" UPDATE" +
" device_channel" +
" SET updateTime='${item.updateTime}'" +
"<if test='item.name != null'>, name='${item.name}'</if>" +
"<if test='item.manufacture != null'>, manufacture='${item.manufacture}'</if>" +
"<if test='item.model != null'>, model='${item.model}'</if>" +
"<if test='item.owner != null'>, owner='${item.owner}'</if>" +
"<if test='item.civilCode != null'>, civilCode='${item.civilCode}'</if>" +
"<if test='item.block != null'>, block='${item.block}'</if>" +
"<if test='item.subCount != null'>, block=${item.subCount}</if>" +
"<if test='item.address != null'>, address='${item.address}'</if>" +
"<if test='item.parental != null'>, parental=${item.parental}</if>" +
"<if test='item.parentId != null'>, parentId='${item.parentId}'</if>" +
"<if test='item.safetyWay != null'>, safetyWay=${item.safetyWay}</if>" +
"<if test='item.registerWay != null'>, registerWay=${item.registerWay}</if>" +
"<if test='item.certNum != null'>, certNum='${item.certNum}'</if>" +
"<if test='item.certifiable != null'>, certifiable=${item.certifiable}</if>" +
"<if test='item.errCode != null'>, errCode=${item.errCode}</if>" +
"<if test='item.secrecy != null'>, secrecy='${item.secrecy}'</if>" +
"<if test='item.ipAddress != null'>, ipAddress='${item.ipAddress}'</if>" +
"<if test='item.port != null'>, port=${item.port}</if>" +
"<if test='item.password != null'>, password='${item.password}'</if>" +
"<if test='item.PTZType != null'>, PTZType=${item.PTZType}</if>" +
"<if test='item.status != null'>, status='${item.status}'</if>" +
"<if test='item.streamId != null'>, streamId='${item.streamId}'</if>" +
"<if test='item.hasAudio != null'>, hasAudio=${item.hasAudio}</if>" +
"<if test='item.longitude != null'>, longitude=${item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=${item.latitude}</if>" +
"<if test='item.longitudeGcj02 != null'>, longitudeGcj02=${item.longitudeGcj02}</if>" +
"<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +
"<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
"<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
" SET updateTime=#{item.updateTime}" +
"<if test='item.name != null'>, name=#{item.name}</if>" +
"<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" +
"<if test='item.model != null'>, model=#{item.model}</if>" +
"<if test='item.owner != null'>, owner=#{item.owner}</if>" +
"<if test='item.civilCode != null'>, civilCode=#{item.civilCode}</if>" +
"<if test='item.block != null'>, block=#{item.block}</if>" +
"<if test='item.subCount != null'>, block=#{item.subCount}</if>" +
"<if test='item.address != null'>, address=#{item.address}</if>" +
"<if test='item.parental != null'>, parental=#{item.parental}</if>" +
"<if test='item.parentId != null'>, parentId=#{item.parentId}</if>" +
"<if test='item.safetyWay != null'>, safetyWay=#{item.safetyWay}</if>" +
"<if test='item.registerWay != null'>, registerWay=#{item.registerWay}</if>" +
"<if test='item.certNum != null'>, certNum=#{item.certNum}</if>" +
"<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" +
"<if test='item.errCode != null'>, errCode=#{item.errCode}</if>" +
"<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" +
"<if test='item.ipAddress != null'>, ipAddress=#{item.ipAddress}</if>" +
"<if test='item.port != null'>, port=#{item.port}</if>" +
"<if test='item.password != null'>, password=#{item.password}</if>" +
"<if test='item.PTZType != null'>, PTZType=#{item.PTZType}</if>" +
"<if test='item.status != null'>, status=#{item.status}</if>" +
"<if test='item.streamId != null'>, streamId=#{item.streamId}</if>" +
"<if test='item.hasAudio != null'>, hasAudio=#{item.hasAudio}</if>" +
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
"<if test='item.longitudeGcj02 != null'>, longitudeGcj02=#{item.longitudeGcj02}</if>" +
"<if test='item.latitudeGcj02 != null'>, latitudeGcj02=#{item.latitudeGcj02}</if>" +
"<if test='item.longitudeWgs84 != null'>, longitudeWgs84=#{item.longitudeWgs84}</if>" +
"<if test='item.latitudeWgs84 != null'>, latitudeWgs84=#{item.latitudeWgs84}</if>" +
"<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
"<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
"WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
"WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+
"</foreach>" +
"</script>"})
int batchUpdate(List<DeviceChannel> updateChannels);
@ -248,7 +248,7 @@ public interface DeviceChannelMapper {
"device_channel dc1 " +
"WHERE " +
"dc1.deviceId = #{deviceId} " +
" <if test='query != null'> AND (dc1.channelId LIKE '%${query}%' OR dc1.name LIKE '%${query}%' OR dc1.name LIKE '%${query}%')</if> " +
" <if test='query != null'> AND (dc1.channelId LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%') OR dc1.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='parentChannelId != null'> AND dc1.parentId=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc1.status=1</if>" +
" <if test='online == false' > AND dc1.status=0</if>" +
@ -286,13 +286,13 @@ public interface DeviceChannelMapper {
@Update(value = {" <script>" +
"UPDATE device_channel " +
"SET " +
"latitude=${latitude}, " +
"longitude=${longitude}, " +
"longitudeGcj02=${longitudeGcj02}, " +
"latitudeGcj02=${latitudeGcj02}, " +
"longitudeWgs84=${longitudeWgs84}, " +
"latitudeWgs84=${latitudeWgs84}, " +
"gpsTime='${gpsTime}' " +
"latitude=#{latitude}, " +
"longitude=#{longitude}, " +
"longitudeGcj02=#{longitudeGcj02}, " +
"latitudeGcj02=#{latitudeGcj02}, " +
"longitudeWgs84=#{longitudeWgs84}, " +
"latitudeWgs84=#{latitudeWgs84}, " +
"gpsTime=#{gpsTime} " +
"WHERE deviceId=#{deviceId} " +
" <if test='channelId != null' > AND channelId=#{channelId}</if>" +
" </script>"})
@ -309,10 +309,10 @@ public interface DeviceChannelMapper {
"select * " +
"from device_channel " +
"where deviceId=#{deviceId}" +
" <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" +
" <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" +
" <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} and length(channelId)=#{length} </if>" +
" <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=#{length} </if>" +
" <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +
" <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" +
" <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, #{parentId.length()}) = #{parentId} </if>" +
" </script>"})
List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);

View File

@ -104,21 +104,21 @@ public interface DeviceMapper {
@Update(value = {" <script>" +
"UPDATE device " +
"SET updateTime='${updateTime}'" +
"<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
"<if test=\"model != null\">, model='${model}'</if>" +
"<if test=\"firmware != null\">, firmware='${firmware}'</if>" +
"<if test=\"transport != null\">, transport='${transport}'</if>" +
"<if test=\"ip != null\">, ip='${ip}'</if>" +
"<if test=\"localIp != null\">, localIp='${localIp}'</if>" +
"<if test=\"port != null\">, port=${port}</if>" +
"<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +
"<if test=\"online != null\">, online=${online}</if>" +
"<if test=\"registerTime != null\">, registerTime='${registerTime}'</if>" +
"<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" +
"<if test=\"expires != null\">, expires=${expires}</if>" +
"WHERE deviceId='${deviceId}'"+
"SET updateTime=#{updateTime}" +
"<if test=\"name != null\">, name=#{name}</if>" +
"<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" +
"<if test=\"model != null\">, model=#{model}</if>" +
"<if test=\"firmware != null\">, firmware=#{firmware}</if>" +
"<if test=\"transport != null\">, transport=#{transport}</if>" +
"<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"localIp != null\">, localIp=#{localIp}</if>" +
"<if test=\"port != null\">, port=#{port}</if>" +
"<if test=\"hostAddress != null\">, hostAddress=#{hostAddress}</if>" +
"<if test=\"online != null\">, online=#{online}</if>" +
"<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" +
"<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" +
"<if test=\"expires != null\">, expires=#{expires}</if>" +
"WHERE deviceId=#{deviceId}"+
" </script>"})
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 = {" <script>" +
"UPDATE device " +
"SET updateTime='${updateTime}'" +
"<if test=\"name != null\">, custom_name='${name}'</if>" +
"<if test=\"password != null\">, password='${password}'</if>" +
"<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
"<if test=\"ip != null\">, ip='${ip}'</if>" +
"<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +
"<if test=\"port != null\">, port=${port}</if>" +
"<if test=\"charset != null\">, charset='${charset}'</if>" +
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +
"<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" +
"<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" +
"<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +
"<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
"SET updateTime=#{updateTime}" +
"<if test=\"name != null\">, custom_name=#{name}</if>" +
"<if test=\"password != null\">, password=#{password}</if>" +
"<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" +
"<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
"<if test=\"port != null\">, port=#{port}</if>" +
"<if test=\"charset != null\">, charset=#{charset}</if>" +
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" +
"<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=#{subscribeCycleForMobilePosition}</if>" +
"<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" +
"<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" +
"<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" +
"<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
"<if test=\"treeType != null\">, treeType=#{treeType}</if>" +
"<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
"WHERE deviceId='${deviceId}'"+
"WHERE deviceId=#{deviceId}"+
" </script>"})
int updateCustom(Device device);

View File

@ -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 = {" <script>" +

View File

@ -16,9 +16,9 @@ public interface GbStreamMapper {
@Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +
"longitude, latitude, streamType, mediaServerId, createTime) VALUES" +
"('${app}', '${stream}', '${gbId}', '${name}', " +
"'${longitude}', '${latitude}', '${streamType}', " +
"'${mediaServerId}', '${createTime}')")
"(#{app}, #{stream}, #{gbId}, #{name}, " +
"#{longitude}, #{latitude}, #{streamType}, " +
"#{mediaServerId}, #{createTime})")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
int add(GbStream gbStream);
@ -57,7 +57,7 @@ public interface GbStreamMapper {
"(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " +
" <if test='catalogId == null'> AND gs.gbStreamId not in" +
"(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " +
" <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> " +
" <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> " +
" <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +
" order by gs.gbStreamId asc " +
"</script>")
@ -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("<script> "+
@ -122,9 +122,9 @@ public interface GbStreamMapper {
"longitude, latitude, streamType, mediaServerId, createTime)" +
"values " +
"<foreach collection='subList' index='index' item='item' separator=','> " +
"('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
"'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
"'${item.mediaServerId}', '${item.createTime}') "+
"(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " +
"#{item.longitude}, #{item.latitude}, #{item.streamType}, " +
"#{item.mediaServerId}, #{item.createTime}) "+
"</foreach> " +
"</script>")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
@ -134,7 +134,7 @@ public interface GbStreamMapper {
"<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
" UPDATE" +
" gb_stream" +
" SET longitude=${item.lng}, latitude=${item.lat} " +
" SET longitude=#{item.lng}, latitude=#{item.lat} " +
"WHERE gbId=#{item.id}"+
"</foreach>" +
"</script>"})

View File

@ -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 = {"<script>" +
" SELECT * FROM log " +
" WHERE 1=1 " +
" <if test=\"query != null\"> AND (name LIKE '%${query}%')</if> " +
" <if test=\"type != null\" > AND type = '${type}'</if>" +
" <if test=\"startTime != null\" > AND createTime &gt;= '${startTime}' </if>" +
" <if test=\"endTime != null\" > AND createTime &lt;= '${endTime}' </if>" +
" <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
" <if test=\"type != null\" > AND type = #{type}</if>" +
" <if test=\"startTime != null\" > AND createTime &gt;= #{startTime} </if>" +
" <if test=\"endTime != null\" > AND createTime &lt;= #{endTime} </if>" +
" ORDER BY createTime DESC " +
" </script>"})
List<LogDto> query(String query, String type, String startTime, String endTime);

View File

@ -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 = {" <script>" +
"UPDATE media_server " +
"SET updateTime='${updateTime}'" +
"<if test=\"ip != null\">, ip='${ip}'</if>" +
"<if test=\"hookIp != null\">, hookIp='${hookIp}'</if>" +
"<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +
"<if test=\"streamIp != null\">, streamIp='${streamIp}'</if>" +
"<if test=\"httpPort != null\">, httpPort=${httpPort}</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=${httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=${rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=${rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=${rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=${rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=${rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=${autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=${rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange='${rtpPortRange}'</if>" +
"<if test=\"secret != null\">, secret='${secret}'</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +
"WHERE id='${id}'"+
"SET updateTime=#{updateTime}" +
"<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
"<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +
"<if test=\"httpPort != null\">, httpPort=#{httpPort}</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" +
"<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" +
"WHERE id=#{id}"+
" </script>"})
int update(MediaServerItem mediaServerItem);
@Update(value = {" <script>" +
"UPDATE media_server " +
"SET updateTime='${updateTime}'" +
"<if test=\"id != null\">, id='${id}'</if>" +
"<if test=\"hookIp != null\">, hookIp='${hookIp}'</if>" +
"<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +
"<if test=\"streamIp != null\">, streamIp='${streamIp}'</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=${httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=${rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=${rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=${rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=${rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=${rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=${autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=${rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange='${rtpPortRange}'</if>" +
"<if test=\"secret != null\">, secret='${secret}'</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +
"WHERE ip='${ip}' and httpPort=${httpPort}"+
"SET updateTime=#{updateTime}" +
"<if test=\"id != null\">, id=#{id}</if>" +
"<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" +
"<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" +
"<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" +
"WHERE ip=#{ip} and httpPort=#{httpPort}"+
" </script>"})
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<MediaServerItem> 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")

View File

@ -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}, " +

View File

@ -21,22 +21,22 @@ public interface PlatformChannelMapper {
* 查询列表里已经关联的
*/
@Select("<script> "+
"SELECT deviceChannelId FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> '${item.id}'</foreach>" +
"SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" +
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
"</script>")
List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
@Insert("<script> "+
"INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" +
"<foreach collection='channelReducesToAdd' item='item' separator=','>" +
" ('${platformId}', '${item.id}' , '${item.catalogId}' )" +
" (#{platformId}, #{item.id} , #{item.catalogId} )" +
"</foreach>" +
"</script>")
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
@Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > '${item.id}'</foreach>" +
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" +
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
"</script>")
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
@ -50,14 +50,14 @@ public interface PlatformChannelMapper {
int delChannelForDeviceId(String deviceId);
@Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE platformId='${platformId}'" +
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" +
"</script>")
int cleanChannelForGB(String platformId);
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId=#{channelId} and pgc.platformId=#{platformId}")
List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId='${platformId}' and pgc.catalogId=#{catalogId}")
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +

View File

@ -26,7 +26,7 @@ public interface PlatformGbStreamMapper {
"(gbStreamId, platformId, catalogId) " +
"values " +
"<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
"(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" +
"(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" +
"</foreach> " +
"</script>")
int batchAdd(List<StreamPushItem> streamPushItems);

View File

@ -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")

View File

@ -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 = {" <script>" +
"UPDATE user_role " +
"SET updateTime='${updateTime}' " +
"<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"authority != null\">, authority='${authority}'</if>" +
"SET updateTime=#{updateTime} " +
"<if test=\"name != null\">, name=#{name}</if>" +
"<if test=\"authority != null\">, authority=#{authority}</if>" +
"WHERE id != 1 and id=#{id}" +
" </script>"})
int update(Role role);

View File

@ -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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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<StreamProxyItem> 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);

View File

@ -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 = {" <script>" +
"UPDATE stream_push " +
"SET updateTime='${updateTime}'" +
"<if test=\"mediaServerId != null\">, mediaServerId='${mediaServerId}'</if>" +
"<if test=\"totalReaderCount != null\">, totalReaderCount='${totalReaderCount}'</if>" +
"<if test=\"originType != null\">, originType=${originType}</if>" +
"<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" +
"<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" +
"<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" +
"<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" +
"<if test=\"self != null\">, self=${self}</if>" +
"SET updateTime=#{updateTime}" +
"<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
"<if test=\"totalReaderCount != null\">, totalReaderCount=#{totalReaderCount}</if>" +
"<if test=\"originType != null\">, originType=#{originType}</if>" +
"<if test=\"originTypeStr != null\">, originTypeStr=#{originTypeStr}</if>" +
"<if test=\"pushTime != null\">, pushTime=#{pushTime}</if>" +
"<if test=\"aliveSecond != null\">, aliveSecond=#{aliveSecond}</if>" +
"<if test=\"pushIng != null\">, pushIng=#{pushIng}</if>" +
"<if test=\"self != null\">, self=#{self}</if>" +
"WHERE app=#{app} AND stream=#{stream}"+
" </script>"})
int update(StreamPushItem streamPushItem);
@ -76,7 +76,7 @@ public interface StreamPushMapper {
"on st.app = gs.app AND st.stream = gs.stream " +
"WHERE " +
"1=1 " +
" <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> " +
" <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> " +
" <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" +
" <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" +
" <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
@ -94,9 +94,9 @@ public interface StreamPushMapper {
"Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
"createTime, aliveSecond, mediaServerId, status, pushIng) " +
"VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
"( '${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} )" +
" </foreach>" +
"</script>")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@ -115,12 +115,12 @@ public interface StreamPushMapper {
List<StreamPushItem> 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);

View File

@ -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 = {" <script>" +
"UPDATE user " +
"SET updateTime='${updateTime}' " +
"<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
"<if test=\"role != null\">, roleId='${role.id}'</if>" +
"<if test=\"password != null\">, password='${password}'</if>" +
"<if test=\"username != null\">, username='${username}'</if>" +
"SET updateTime=#{updateTime} " +
"<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" +
"<if test=\"role != null\">, roleId=#{role.id}</if>" +
"<if test=\"password != null\">, password=#{password}</if>" +
"<if test=\"username != null\">, username=#{username}</if>" +
"WHERE id=#{id}" +
" </script>"})
int update(User user);
@ -50,10 +50,10 @@ public interface UserMapper {
@ResultMap(value="roleMap")
List<User> 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<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
@Select("select * from user where md5(pushKey) = '${sign}'")
@Select("select * from user where md5(pushKey) = #{sign}")
List<User> 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")