From 77db8a1264fcba82fb124e5a0938dcc347c10724 Mon Sep 17 00:00:00 2001 From: tangwei Date: Wed, 17 Jun 2026 09:33:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fh/service/impl/FhHabitatServiceImpl.java | 11 +++++------ .../fp/service/impl/FpBuildServiceImpl.java | 3 +-- .../fpr/service/impl/FprMonitorServiceImpl.java | 10 ++++++++-- .../service/impl/VpConstructionServiceImpl.java | 17 +++++------------ .../wq/service/impl/EnvWqDataServiceImpl.java | 3 +-- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fh/service/impl/FhHabitatServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/fh/service/impl/FhHabitatServiceImpl.java index 9b6dd008..1f7a1337 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fh/service/impl/FhHabitatServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fh/service/impl/FhHabitatServiceImpl.java @@ -278,8 +278,9 @@ public class FhHabitatServiceImpl implements FhHabitatService { } sql.append(buildSdrvwtsOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort())); - PageInfo pageInfo = loadOptions == null ? null : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo != null && pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; +// PageInfo pageInfo = loadOptions == null ? null : QgcQueryWrapperUtil.getPageInfo(loadOptions); +// Page page = pageInfo != null && pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); List list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FhSdrvwtsVo.class); DataSourceResult result = new DataSourceResult<>(); @@ -330,8 +331,7 @@ public class FhHabitatServiceImpl implements FhHabitatService { } sql.append(buildSdriverdaysOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort())); - PageInfo pageInfo = loadOptions == null ? null : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo != null && pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); List list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FhSdriverdayVo.class); DataSourceResult result = new DataSourceResult<>(); @@ -1744,8 +1744,7 @@ public class FhHabitatServiceImpl implements FhHabitatService { sql.append(buildStTbYsOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort())); DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? null : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo != null && pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); List list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, StTbYsVo.class); DataSourceResult result = new DataSourceResult<>(); diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fp/service/impl/FpBuildServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/fp/service/impl/FpBuildServiceImpl.java index 86f893c6..88b8a6f9 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fp/service/impl/FpBuildServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fp/service/impl/FpBuildServiceImpl.java @@ -36,8 +36,7 @@ public class FpBuildServiceImpl implements FpBuildService { @Override public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest(); - PageInfo pageInfo = QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); String sql = "SELECT t.STTP AS sttpCode, " + " SUM(CASE WHEN t.DTIN = 1 THEN 1 ELSE 0 END) AS bonusing, " + diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fpr/service/impl/FprMonitorServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/fpr/service/impl/FprMonitorServiceImpl.java index 993da4ea..94858b0a 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fpr/service/impl/FprMonitorServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fpr/service/impl/FprMonitorServiceImpl.java @@ -1185,8 +1185,14 @@ public class FprMonitorServiceImpl implements FprMonitorService { if (CollUtil.isEmpty(resultList) || loadOptions == null || loadOptions.getTake() == null || loadOptions.getTake() <= 0) { return resultList; } - int start = Math.max(loadOptions.getSkip() == null ? 0 : loadOptions.getSkip(), 0); - int end = Math.min(start + loadOptions.getTake(), resultList.size()); + int page = loadOptions.getSkip() == null ? 1 : loadOptions.getSkip(); // 页码从1开始,缺省为1 + // 如果页码 ≤ 0,强制设为1(避免负值) + if (page < 1) { + page = 1; + } + int size = loadOptions.getTake(); + int start = (page - 1) * size; + int end = Math.min(start + size, resultList.size()); if (start >= resultList.size()) { return new ArrayList<>(); } diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/vap/service/impl/VpConstructionServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/vap/service/impl/VpConstructionServiceImpl.java index 14a36f2a..9a2ad153 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/vap/service/impl/VpConstructionServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/vap/service/impl/VpConstructionServiceImpl.java @@ -39,8 +39,7 @@ public class VpConstructionServiceImpl implements VpConstructionService { @Override public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? new PageInfo() : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); String isBotanicalGarden = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "isBotanicalGarden"); @@ -90,8 +89,7 @@ public class VpConstructionServiceImpl implements VpConstructionService { @Override public DataSourceResult processVmsstbprptList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? new PageInfo() : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); Map paramMap = new HashMap<>(); StringBuilder sql = new StringBuilder(buildVmsstbprptBaseSql()); @@ -177,9 +175,7 @@ public class VpConstructionServiceImpl implements VpConstructionService { @Override public DataSourceResult processWvaKendoList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? new PageInfo() : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; - + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); Map paramMap = new HashMap<>(); StringBuilder sql = new StringBuilder(buildWvaBaseSql()); String filterSql = buildWvaFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), @@ -218,8 +214,7 @@ public class VpConstructionServiceImpl implements VpConstructionService { @Override public DataSourceResult processVacKendoList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? new PageInfo() : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); String isZoo = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "isZoo"); Map paramMap = new HashMap<>(); @@ -260,9 +255,7 @@ public class VpConstructionServiceImpl implements VpConstructionService { @Override public DataSourceResult processVarKendoList(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? new PageInfo() : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; - + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); Map paramMap = new HashMap<>(); StringBuilder sql = new StringBuilder(buildVarBaseSql()); String filterSql = buildVarFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/wq/service/impl/EnvWqDataServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/wq/service/impl/EnvWqDataServiceImpl.java index c984ae0c..6910a908 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/wq/service/impl/EnvWqDataServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/wq/service/impl/EnvWqDataServiceImpl.java @@ -3501,8 +3501,7 @@ public class EnvWqDataServiceImpl implements EnvWqDataService { sql.append(buildStTbYsOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort())); DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); - PageInfo pageInfo = loadOptions == null ? null : QgcQueryWrapperUtil.getPageInfo(loadOptions); - Page page = pageInfo != null && pageInfo.getHasPageInfo() ? pageInfo.getPage() : null; + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); List list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, StTbYsVo.class); DataSourceResult result = new DataSourceResult<>();