fix: 优化逻辑

This commit is contained in:
tangwei 2026-07-21 10:20:25 +08:00
parent 5425db84e8
commit 8a6c319933
4 changed files with 35 additions and 5 deletions

View File

@ -179,12 +179,12 @@ public class SdFhbtBH implements Serializable {
/**
* 保护河流
*/
private Integer bhhl;
private String bhhl;
/**
* 保护河道
*/
private Integer bhhd;
private String bhhd;
/**
* 保护措施
@ -224,7 +224,7 @@ public class SdFhbtBH implements Serializable {
/**
* 植被覆盖类型
*/
private BigDecimal vlsr;
private String vlsr;
/**
* 植被覆盖调查时间

View File

@ -39,6 +39,9 @@ public class SdWqBH implements Serializable {
private String wwqtg;
@TableField(exist = false)
private String wwqtgName;
private String wqtype;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

View File

@ -51,6 +51,7 @@ public class SdWqBHServiceImpl extends ServiceImpl<SdWqBHMapper, SdWqBH> impleme
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtin").modifyProperty("dtinName").dictType("STATIC").dictSource("DTIN").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("mway").modifyProperty("mwayName").dictType("STATIC").dictSource("MWAY").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("bldsttCode").modifyProperty("bldsttCodeName").dictType("STATIC").dictSource("BLDSTT_CODE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("wwqtg").modifyProperty("wwqtgName").dictType("STATIC").dictSource("WWQTG").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtinType").modifyProperty("dtinTypeName").dictType("STATIC").dictSource("DTIN_TYPE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("sttp").modifyProperty("sttpName").dictType("DYNAMIC").dictSource("SD_STTP_B").codeColumn("STTP_CODE").nameColumn("STTP_NAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());

View File

@ -67,8 +67,8 @@ public class MsThreedRoamMServiceImpl extends ServiceImpl<MsThreedRoamMMapper, M
}
// 排序
sql.append(" ORDER BY a.CODE ASC");
// sql.append(" ORDER BY a.CODE ASC");
sql.append(buildThreedRoamMQgcOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
Page<?> page = loadOptions == null ? null
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
List<MsThreedRoamMEntity> list = microservicDynamicSQLMapper.pageAllListWithResultType(
@ -82,6 +82,31 @@ public class MsThreedRoamMServiceImpl extends ServiceImpl<MsThreedRoamMMapper, M
return result;
}
private String buildThreedRoamMQgcOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
if (CollUtil.isEmpty(sorts)) {
return " ORDER BY r.tm DESC NULLS LAST, r.stcd ASC, r.name ASC";
}
List<String> orderByParts = new ArrayList<>();
for (DataSourceRequest.SortDescriptor sort : sorts) {
if (sort == null || StrUtil.isBlank(sort.getField())) {
continue;
}
String column = mapToListColumn(sort.getField());
if (StrUtil.isBlank(column)) {
continue;
}
String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
orderByParts.add(column + " " + direction + " NULLS LAST");
}
if (orderByParts.isEmpty()) {
return " ORDER BY r.tm DESC NULLS LAST, r.stcd ASC, r.name ASC";
}
return " ORDER BY " + String.join(", ", orderByParts);
}
/**
* 递归构建过滤 SQL
*/
@ -141,6 +166,7 @@ public class MsThreedRoamMServiceImpl extends ServiceImpl<MsThreedRoamMMapper, M
case "name" -> "a.NAME";
case "rvcd" -> "a.RVCD";
case "remark" -> "a.REMARK";
case "modifyTime" -> "a.MODIFY_TIME";
default -> null;
};
}