fix: 优化地图查询接口逻辑

This commit is contained in:
tangwei 2026-07-07 13:38:59 +08:00
parent 195ccc58d1
commit 8c9f25c90f
2 changed files with 59 additions and 13 deletions

View File

@ -4654,21 +4654,32 @@ public class FbStationServiceImpl implements FbStationService {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
if (StrUtil.isNotEmpty(sttp)) { // if (StrUtil.isNotEmpty(sttp)) {
sql.append(" AND a.STTP = :sttp "); // sql.append(" AND a.STTP = #{sttp} ");
paramMap.put("sttp", sttp); // paramMap.put("sttp", sttp);
} // }
if (StrUtil.isNotEmpty(rstcd)) { // if (StrUtil.isNotEmpty(rstcd)) {
sql.append(" AND a.RSTCD LIKE '%' || :rstcd || '%' "); // sql.append(" AND a.RSTCD LIKE '%' || #{rstcd} || '%' ");
paramMap.put("rstcd", rstcd); // paramMap.put("rstcd", rstcd);
} // }
if (StrUtil.isNotEmpty(bldsttCcode)) { // if (StrUtil.isNotEmpty(bldsttCcode)) {
sql.append(" AND a.BLDSTT_CODE = :bldsttCcode "); // sql.append(" AND a.BLDSTT_CODE = #{bldsttCcode} ");
paramMap.put("bldsttCcode", Integer.parseInt(bldsttCcode)); // paramMap.put("bldsttCcode", Integer.parseInt(bldsttCcode));
// }
String filterSql = QgcQueryWrapperUtil.buildFilterCondition(
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
paramMap,
new int[]{0},
this::mapWeFvColumn
);
if (StrUtil.isNotBlank(filterSql)) {
sql.append("AND ").append(filterSql).append(" ");
} }
sql.append(" ORDER BY NVL(siteSort.SORT, 999999) ASC "); sql.append(" ORDER BY NVL(siteSort.SORT, 999999) ASC ");
Page<?> page = devRequest == null ? null : QgcQueryWrapperUtil.buildPage(devRequest, devRequest.getSkip(), devRequest.getTake()); Page<?> page = devRequest == null ? null : QgcQueryWrapperUtil.buildPage(devRequest, devRequest.getSkip(), devRequest.getTake());
List<FbTracingPointVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FbTracingPointVo.class); List<FbTracingPointVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FbTracingPointVo.class);
@ -4686,6 +4697,21 @@ public class FbStationServiceImpl implements FbStationService {
return dataSourceResult; return dataSourceResult;
} }
private String mapWeFvColumn(String field) {
if (StrUtil.isBlank(field)) {
return null;
}
return switch (field.toLowerCase()) {
case "rstcd" -> "a.RSTCD";
case "stcd" -> "a.STCD";
case "sttp" -> "a.STTP";
case "bldsttCcode" -> "a.BLDSTT_CODE";
case "lgtd" -> "a.LGTD";
default -> null;
};
}
private List<FbTracingPointVo> getPointLegend(List<FbTracingPointVo> voList) { private List<FbTracingPointVo> getPointLegend(List<FbTracingPointVo> voList) {
for (FbTracingPointVo pointVo : voList) { for (FbTracingPointVo pointVo : voList) {
Integer bldstt = pointVo.getBldstt(); Integer bldstt = pointVo.getBldstt();

View File

@ -1933,7 +1933,7 @@ public class FhHabitatServiceImpl implements FhHabitatService {
dataSourceResult.setTotal(0L); dataSourceResult.setTotal(0L);
return dataSourceResult; return dataSourceResult;
} }
Map<String, Object> paramMap = new HashMap<>();
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
sql.append("SELECT ") sql.append("SELECT ")
.append("t.BASE_ID AS baseId, ") .append("t.BASE_ID AS baseId, ")
@ -1967,6 +1967,15 @@ public class FhHabitatServiceImpl implements FhHabitatService {
.append("WHERE t.LGTD IS NOT NULL AND t.LTTD IS NOT NULL "); .append("WHERE t.LGTD IS NOT NULL AND t.LTTD IS NOT NULL ");
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest(); DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
String filterSql = QgcQueryWrapperUtil.buildFilterCondition(
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
paramMap,
new int[]{0},
this::mapWeFvColumn
);
if (StrUtil.isNotBlank(filterSql)) {
sql.append("AND ").append(filterSql).append(" ");
}
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
List<FhHaVapVo> vaVpList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), new HashMap<>(), FhHaVapVo.class); List<FhHaVapVo> vaVpList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), new HashMap<>(), FhHaVapVo.class);
@ -1994,4 +2003,15 @@ public class FhHabitatServiceImpl implements FhHabitatService {
dataSourceResult.setTotal(page == null ? vaVpList.size() : page.getTotal()); dataSourceResult.setTotal(page == null ? vaVpList.size() : page.getTotal());
return dataSourceResult; return dataSourceResult;
} }
private String mapWeFvColumn(String field) {
if (StrUtil.isBlank(field)) {
return null;
}
return switch (field.toLowerCase()) {
case "sttpCode" -> "t.sttp";
case "lgtd" -> "t.lgtd";
default -> null;
};
}
} }