修复sql模糊查询中含有特殊符号时查询不准备的BUG
parent
86879aa58d
commit
6e8a3f6adf
|
@ -119,6 +119,7 @@ public interface CommonGBChannelMapper {
|
|||
", gb_block = #{gbBlock}" +
|
||||
", gb_address = #{gbAddress}" +
|
||||
", gb_parental = #{gbParental}" +
|
||||
", gb_parent_id = #{gbParentId}" +
|
||||
", gb_safety_way = #{gbSafetyWay}" +
|
||||
", gb_register_way = #{gbRegisterWay}" +
|
||||
", gb_cert_num = #{gbCertNum}" +
|
||||
|
|
|
@ -330,7 +330,11 @@ public interface DeviceMapper {
|
|||
" FROM wvp_device de" +
|
||||
" where 1 = 1 "+
|
||||
" <if test='status != null'> AND de.on_line=${status}</if>"+
|
||||
" <if test='query != null'> AND (coalesce(custom_name, name) LIKE '%${query}%' OR device_id LIKE '%${query}%' OR ip LIKE '%${query}%')</if> " +
|
||||
" <if test='query != null'> AND (" +
|
||||
" coalesce(custom_name, name) LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR device_id LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR ip LIKE concat('%',#{query},'%') escape '/')" +
|
||||
"</if> " +
|
||||
" order by create_time desc "+
|
||||
" </script>")
|
||||
List<Device> getDeviceList(@Param("query") String query, @Param("status") Boolean status);
|
||||
|
|
|
@ -71,7 +71,7 @@ public interface PlatformMapper {
|
|||
" ) as channel_count" +
|
||||
" FROM wvp_platform pp where 1=1 " +
|
||||
" <if test='query != null'> " +
|
||||
" AND (pp.name LIKE concat('%',#{query},'%') OR pp.server_gb_id LIKE concat('%',#{query},'%') )</if> " +
|
||||
" AND (pp.name LIKE concat('%',#{query},'%') escape '/' OR pp.server_gb_id LIKE concat('%',#{query},'%') escape '/' )</if> " +
|
||||
" order by pp.id desc"+
|
||||
" </script>")
|
||||
List<Platform> queryList(@Param("query") String query);
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface RegionMapper {
|
|||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * from wvp_common_region WHERE 1=1 " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='parentId != null'> AND parent_device_id = #{parentId}</if> " +
|
||||
"ORDER BY id " +
|
||||
" </script>"})
|
||||
|
@ -79,7 +79,7 @@ public interface RegionMapper {
|
|||
" where " +
|
||||
" <if test='parentId != null'> parent_id = #{parentId} </if> " +
|
||||
" <if test='parentId == null'> parent_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" </script>")
|
||||
List<RegionTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
|
||||
|
||||
|
|
|
@ -519,6 +519,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
@Override
|
||||
public PageInfo<Device> getAll(int page, int count, String query, Boolean status) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<Device> all = deviceMapper.getDeviceList(query, status);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
|
|
@ -159,6 +159,11 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
@Override
|
||||
public PageInfo<Platform> queryPlatformList(int page, int count, String query) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<Platform> all = platformMapper.queryList(query);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
|
|
@ -97,6 +97,11 @@ public class RegionServiceImpl implements IRegionService {
|
|||
@Override
|
||||
public PageInfo<Region> query(String query, int page, int count) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<Region> regionList = regionMapper.query(query, null);
|
||||
return new PageInfo<>(regionList);
|
||||
}
|
||||
|
@ -140,6 +145,11 @@ public class RegionServiceImpl implements IRegionService {
|
|||
|
||||
@Override
|
||||
public List<RegionTree> queryForTree(String query, Integer parent, Boolean hasChannel) {
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<RegionTree> regionList = regionMapper.queryForTree(query, parent);
|
||||
if (parent != null && hasChannel != null && hasChannel) {
|
||||
Region parentRegion = regionMapper.queryOne(parent);
|
||||
|
|
|
@ -71,6 +71,11 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
|
|||
|
||||
}
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<CloudRecordItem> all = cloudRecordServiceMapper.getList(query, app, stream, startTimeStamp, endTimeStamp,
|
||||
callId, mediaServerItems, null);
|
||||
return new PageInfo<>(all);
|
||||
|
|
|
@ -41,7 +41,7 @@ public interface CloudRecordServiceMapper {
|
|||
"select * " +
|
||||
" from wvp_cloud_record " +
|
||||
" where 0 = 0" +
|
||||
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') OR stream LIKE concat('%',#{query},'%') )</if> " +
|
||||
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE concat('%',#{query},'%') escape '/' )</if> " +
|
||||
" <if test= 'app != null '> and app=#{app}</if>" +
|
||||
" <if test= 'stream != null '> and stream=#{stream}</if>" +
|
||||
" <if test= 'startTimeStamp != null '> and end_time >= #{startTimeStamp}</if>" +
|
||||
|
|
|
@ -36,13 +36,13 @@ public class StreamProxyProvider {
|
|||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND ")
|
||||
.append(" (")
|
||||
.append(" st.app LIKE ").append("'%").append(params.get("query")).append("%'")
|
||||
.append(" st.app LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" st.stream LIKE ").append("'%").append(params.get("query")).append("%'")
|
||||
.append(" st.stream LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" wdc.gb_device_id LIKE ").append("'%").append(params.get("query")).append("%'")
|
||||
.append(" wdc.gb_device_id LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" wdc.gb_name LIKE ").append("'%").append(params.get("query")).append("%'")
|
||||
.append(" wdc.gb_name LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" )")
|
||||
;
|
||||
}
|
||||
|
|
|
@ -246,6 +246,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
@Override
|
||||
public PageInfo<StreamProxy> getAll(Integer page, Integer count, String query, Boolean pulling, String mediaServerId) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<StreamProxy> all = streamProxyMapper.selectAll(query, pulling, mediaServerId);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ public interface StreamPushMapper {
|
|||
" on st.id = wdc.stream_push_id " +
|
||||
" WHERE " +
|
||||
" 1=1 " +
|
||||
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') " +
|
||||
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') OR wdc.gb_name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='pushing == true' > AND st.pushing=1</if>" +
|
||||
" <if test='pushing == false' > AND st.pushing=0 </if>" +
|
||||
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
|
||||
|
|
|
@ -175,6 +175,11 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
@Override
|
||||
public PageInfo<StreamPush> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<StreamPush> all = streamPushMapper.selectAll(query, pushing, mediaServerId);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue