mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-02 05:20:15 +08:00
Add total number of fuzzy rows
This commit is contained in:
@ -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())) {
|
||||
|
@ -72,6 +72,12 @@ public class ExecuteResultVO {
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* Total number of fuzzy rows
|
||||
* Only select statements have
|
||||
*/
|
||||
private String fuzzyTotal;
|
||||
|
||||
/**
|
||||
* 执行持续时间
|
||||
*/
|
||||
|
@ -84,6 +84,12 @@ public class ExecuteResult {
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* Total number of fuzzy rows
|
||||
* Only select statements have
|
||||
*/
|
||||
private String fuzzyTotal;
|
||||
|
||||
/**
|
||||
* 执行持续时间
|
||||
*/
|
||||
|
Reference in New Issue
Block a user