Add total number of fuzzy rows

This commit is contained in:
JiaJu Zhuang
2023-07-23 16:13:10 +08:00
parent 81b28289a1
commit c01e8273cb
3 changed files with 26 additions and 0 deletions

View File

@ -140,6 +140,8 @@ public class DlTemplateServiceImpl implements DlTemplateService {
executeResult.getDataList().set(i, newRow);
}
}
// Total number of fuzzy rows
executeResult.setFuzzyTotal(calculateFuzzyTotal(pageNo, pageSize, executeResult));
result.add(executeResult);
if (!executeResult.getSuccess()) {
@ -151,6 +153,18 @@ public class DlTemplateServiceImpl implements DlTemplateService {
return listResult;
}
private String calculateFuzzyTotal(int pageNo, int pageSize, ExecuteResult executeResult) {
int dataSize = CollectionUtils.size(executeResult.getDataList());
if (pageSize <= 0) {
return Integer.toString(dataSize);
}
int fuzzyTotal = Math.max(pageNo - 1, 0) * pageSize + dataSize;
if (dataSize < pageSize) {
return Integer.toString(fuzzyTotal);
}
return Integer.toString(fuzzyTotal) + "+";
}
@Override
public DataResult<Long> count(DlCountParam param) {
if (StringUtils.isBlank(param.getSql())) {

View File

@ -72,6 +72,12 @@ public class ExecuteResultVO {
*/
private Integer pageSize;
/**
* Total number of fuzzy rows
* Only select statements have
*/
private String fuzzyTotal;
/**
* 执行持续时间
*/

View File

@ -84,6 +84,12 @@ public class ExecuteResult {
*/
private Integer pageSize;
/**
* Total number of fuzzy rows
* Only select statements have
*/
private String fuzzyTotal;
/**
* 执行持续时间
*/