修复sql模糊查询中含有特殊符号时查询不准备的BUG

This commit is contained in:
648540858
2024-11-14 14:08:05 +08:00
parent 86879aa58d
commit 6e8a3f6adf
13 changed files with 51 additions and 11 deletions

View File

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

View File

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

View File

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