fix: 优化分页参数
This commit is contained in:
parent
512e3c4e4b
commit
77db8a1264
@ -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<FhSdrvwtsVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FhSdrvwtsVo.class);
|
||||
|
||||
DataSourceResult<FhSdrvwtsVo> 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<FhSdriverdayVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FhSdriverdayVo.class);
|
||||
|
||||
DataSourceResult<FhSdriverdayVo> 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<StTbYsVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, StTbYsVo.class);
|
||||
|
||||
DataSourceResult<StTbYsVo> result = new DataSourceResult<>();
|
||||
|
||||
@ -36,8 +36,7 @@ public class FpBuildServiceImpl implements FpBuildService {
|
||||
@Override
|
||||
public DataSourceResult<FpConstructionSituationVo> 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, " +
|
||||
|
||||
@ -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<>();
|
||||
}
|
||||
|
||||
@ -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<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder(buildVmsstbprptBaseSql());
|
||||
@ -177,9 +175,7 @@ public class VpConstructionServiceImpl implements VpConstructionService {
|
||||
@Override
|
||||
public DataSourceResult<VpWvaRunVo> 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<String, Object> 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<VpVacVo> 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<String, Object> paramMap = new HashMap<>();
|
||||
@ -260,9 +255,7 @@ public class VpConstructionServiceImpl implements VpConstructionService {
|
||||
@Override
|
||||
public DataSourceResult<VpVarVo> 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<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder(buildVarBaseSql());
|
||||
String filterSql = buildVarFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
|
||||
@ -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<StTbYsVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, StTbYsVo.class);
|
||||
|
||||
DataSourceResult<StTbYsVo> result = new DataSourceResult<>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user