Skip to content

Commit

Permalink
Merge 5927432 into 5213290
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnZp authored Feb 22, 2024
2 parents 5213290 + 5927432 commit 7323f87
Show file tree
Hide file tree
Showing 25 changed files with 44 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public PageInfo<AccessToken> queryAccessTokenList(User loginUser, String searchV
userId = 0;
}
IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, searchVal, userId);
pageInfo.setTotal((int) accessTokenList.getTotal());
pageInfo.setTotalList(accessTokenList.getRecords());
pageInfo.setPaginationInfo((int) accessTokenList.getTotal(), accessTokenList.getRecords());
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ public PageInfo<AlertPluginInstanceVO> listPaging(User loginUser, String searchV
alertPluginInstanceMapper.queryByInstanceNamePage(new Page<>(pageNo, pageSize), searchVal);

PageInfo<AlertPluginInstanceVO> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) alertPluginInstanceIPage.getTotal());
pageInfo.setTotalList(buildPluginInstanceVOList(alertPluginInstanceIPage.getRecords()));
pageInfo.setPaginationInfo((int) alertPluginInstanceIPage.getTotal(),
buildPluginInstanceVOList(alertPluginInstanceIPage.getRecords()));
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public PageInfo<AuditDto> queryLogListPaging(User loginUser,
logIPage.getRecords().stream().map(this::transformAuditLog).collect(Collectors.toList());

PageInfo<AuditDto> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) auditDtos.size());
pageInfo.setTotalList(auditDtos);
pageInfo.setPaginationInfo(auditDtos.size(), auditDtos);
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public PageInfo<ClusterDto> queryClusterListPaging(Integer pageNo, Integer pageS
IPage<Cluster> clusterIPage = clusterMapper.queryClusterListPaging(page, searchVal);

PageInfo<ClusterDto> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) clusterIPage.getTotal());

if (CollectionUtils.isEmpty(clusterIPage.getRecords())) {
return pageInfo;
Expand All @@ -130,7 +129,7 @@ public PageInfo<ClusterDto> queryClusterListPaging(Integer pageNo, Integer pageS
BeanUtils.copyProperties(cluster, dto);
return dto;
}).collect(Collectors.toList());
pageInfo.setTotalList(dtoList);
pageInfo.setPaginationInfo((int) clusterIPage.getTotal(), dtoList);
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ public PageInfo<DataSource> queryDataSourceListPaging(User loginUser, String sea

List<DataSource> dataSources = dataSourceList != null ? dataSourceList.getRecords() : new ArrayList<>();
handlePasswd(dataSources);
pageInfo.setTotal((int) (dataSourceList != null ? dataSourceList.getTotal() : 0L));
pageInfo.setTotalList(dataSources);
pageInfo.setPaginationInfo((int) (dataSourceList != null ? dataSourceList.getTotal() : 0L), dataSources);
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public PageInfo<DqExecuteResult> queryResultListPaging(User loginUser,
start,
end);

pageInfo.setTotal((int) dqsResultPage.getTotal());
pageInfo.setTotalList(dqsResultPage.getRecords());
pageInfo.setPaginationInfo((int) dqsResultPage.getTotal(), dqsResultPage.getRecords());
return pageInfo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ public PageInfo<DqRule> queryRuleListPaging(User loginUser,
dqRule.setRuleJson(JSONUtils.toJsonString(ruleDefinition));
});

pageInfo.setTotal((int) dqRulePage.getTotal());
pageInfo.setTotalList(dataList);
pageInfo.setPaginationInfo((int) dqRulePage.getTotal(), dataList);
}

return pageInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ public Result queryEnvironmentListPaging(User loginUser, Integer pageNo, Integer
environmentIPage = environmentMapper.queryEnvironmentListPagingByIds(page, new ArrayList<>(ids), searchVal);
}

pageInfo.setTotal((int) environmentIPage.getTotal());

if (CollectionUtils.isNotEmpty(environmentIPage.getRecords())) {
Map<Long, List<String>> relationMap = relationMapper.selectList(null).stream()
.collect(Collectors.groupingBy(EnvironmentWorkerGroupRelation::getEnvironmentCode,
Expand All @@ -201,9 +199,9 @@ public Result queryEnvironmentListPaging(User loginUser, Integer pageNo, Integer
return dto;
}).collect(Collectors.toList());

pageInfo.setTotalList(dtoList);
pageInfo.setPaginationInfo((int) environmentIPage.getTotal(), dtoList);
} else {
pageInfo.setTotalList(new ArrayList<>());
pageInfo.setPaginationInfo((int) environmentIPage.getTotal(), new ArrayList<>());
}

result.setData(pageInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ public Result queryListPaging(User loginUser, String searchVal, Integer pageNo,

Integer count = (int) k8sNamespaceList.getTotal();
PageInfo<K8sNamespace> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal(count);
pageInfo.setTotalList(k8sNamespaceList.getRecords());
pageInfo.setPaginationInfo(count, k8sNamespaceList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,7 @@ public PageInfo<ProcessDefinition> queryProcessDefinitionListPaging(@NonNull Use
}

PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionsPageListingResult.getTotalCount());
pageInfo.setTotalList(processDefinitions);
pageInfo.setPaginationInfo((int) processDefinitionsPageListingResult.getTotalCount(), processDefinitions);

return pageInfo;
}
Expand Down Expand Up @@ -635,8 +634,7 @@ public PageInfo<ProcessDefinition> filterProcessDefinition(User loginUser,
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo =
new PageInfo<>(workflowFilterRequest.getPageNo(), workflowFilterRequest.getPageSize());
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
pageInfo.setPaginationInfo((int) processDefinitionIPage.getTotal(), processDefinitionIPage.getRecords());

return pageInfo;
}
Expand Down Expand Up @@ -2294,8 +2292,7 @@ public Result queryProcessDefinitionVersions(User loginUser, long projectCode, i
processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();

pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
pageInfo.setPaginationInfo((int) processDefinitionVersionsPaging.getTotal(), processDefinitionLogs);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ public Result<PageInfo<ProcessInstance>> queryProcessInstanceList(User loginUser
}
}

pageInfo.setTotal((int) processInstanceList.getTotal());
pageInfo.setTotalList(processInstances);
pageInfo.setPaginationInfo((int) processInstanceList.getTotal(), processInstances);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down Expand Up @@ -445,8 +444,7 @@ public Result queryProcessInstanceList(User loginUser, WorkflowInstanceQueryRequ
}
}

pageInfo.setTotal((int) processInstanceList.getTotal());
pageInfo.setTotalList(processInstances);
pageInfo.setPaginationInfo((int) processInstanceList.getTotal(), processInstances);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ public Result queryProjectParameterListPaging(User loginUser, long projectCode,

List<ProjectParameter> projectParameterList = iPage.getRecords();

pageInfo.setTotal((int) iPage.getTotal());
pageInfo.setTotalList(projectParameterList);
pageInfo.setPaginationInfo((int) iPage.getTotal(), projectParameterList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,7 @@ public Result queryProjectListPaging(User loginUser, Integer pageSize, Integer p
project.setPerm(Constants.DEFAULT_ADMIN_PERMISSION);
}
}
pageInfo.setTotal((int) projectIPage.getTotal());
pageInfo.setTotalList(projectList);
pageInfo.setPaginationInfo((int) projectIPage.getTotal(), projectList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down Expand Up @@ -444,8 +443,7 @@ public Result queryProjectWithAuthorizedLevelListPaging(Integer userId, User log
}
}

pageInfo.setTotal((int) projectIPage.getTotal());
pageInfo.setTotalList(projectList);
pageInfo.setPaginationInfo((int) projectIPage.getTotal(), projectList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ public PageInfo<Queue> queryList(User loginUser, String searchVal, Integer pageN
Page<Queue> page = new Page<>(pageNo, pageSize);
IPage<Queue> queueList = queueMapper.queryQueuePaging(page, new ArrayList<>(ids), searchVal);
Integer count = (int) queueList.getTotal();
pageInfo.setTotal(count);
pageInfo.setTotalList(queueList.getRecords());
pageInfo.setPaginationInfo(count, queueList.getRecords());
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ public Result<PageInfo<StorageEntity>> queryResourceListPaging(User loginUser, S
List<StorageEntity> slicedResourcesList = filteredResourceList.stream().skip((long) (pageNo - 1) * pageSize)
.limit(pageSize).collect(Collectors.toList());

pageInfo.setTotal(filteredResourceList.size());
pageInfo.setTotalList(slicedResourcesList);
pageInfo.setPaginationInfo(filteredResourceList.size(), slicedResourcesList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@ public Result querySchedule(User loginUser, long projectCode, long processDefine
}

PageInfo<ScheduleVO> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) schedulePage.getTotal());
pageInfo.setTotalList(scheduleList);
pageInfo.setPaginationInfo((int) schedulePage.getTotal(), scheduleList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down Expand Up @@ -503,8 +502,7 @@ public PageInfo<Schedule> filterSchedules(User loginUser,

PageInfo<Schedule> pageInfo =
new PageInfo<>(scheduleFilterRequest.getPageNo(), scheduleFilterRequest.getPageSize());
pageInfo.setTotal((int) scheduleIPage.getTotal());
pageInfo.setTotalList(scheduleIPage.getRecords());
pageInfo.setPaginationInfo((int) scheduleIPage.getTotal(), scheduleIPage.getRecords());

return pageInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,7 @@ public PageInfo<TaskDefinition> filterTaskDefinition(User loginUser,

PageInfo<TaskDefinition> pageInfo =
new PageInfo<>(taskFilterRequest.getPageNo(), taskFilterRequest.getPageSize());
pageInfo.setTotal((int) taskDefinitionIPage.getTotal());
pageInfo.setTotalList(taskDefinitionIPage.getRecords());
pageInfo.setPaginationInfo((int) taskDefinitionIPage.getTotal(), taskDefinitionIPage.getRecords());
return pageInfo;
}

Expand Down Expand Up @@ -1102,8 +1101,7 @@ public Result queryTaskDefinitionVersions(User loginUser,
taskDefinitionLogMapper.queryTaskDefinitionVersionsPaging(page, taskCode, projectCode);
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionVersionsPaging.getRecords();

pageInfo.setTotalList(taskDefinitionLogs);
pageInfo.setTotal((int) taskDefinitionVersionsPaging.getTotal());
pageInfo.setPaginationInfo((int) taskDefinitionVersionsPaging.getTotal(), taskDefinitionLogs);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down Expand Up @@ -1201,8 +1199,7 @@ public Result queryTaskDefinitionListPaging(User loginUser,
// then, query task relevant info by task code
fillRecords(projectCode, taskMainInfoIPage);
PageInfo<TaskMainInfo> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) taskMainInfoIPage.getTotal());
pageInfo.setTotalList(taskMainInfoIPage.getRecords());
pageInfo.setPaginationInfo((int) taskMainInfoIPage.getTotal(), taskMainInfoIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public Map<String, Object> queryTasksByGroupId(User loginUser,
groupId,
projects);

pageInfo.setTotal((int) taskGroupQueue.getTotal());
pageInfo.setTotalList(taskGroupQueue.getRecords());
pageInfo.setPaginationInfo((int) taskGroupQueue.getTotal(), taskGroupQueue.getRecords());

result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
Expand Down Expand Up @@ -135,8 +134,7 @@ public Map<String, Object> doQuery(User loginUser, int pageNo, int pageSize,
IPage<TaskGroupQueue> taskGroupQueue = taskGroupQueueMapper.queryTaskGroupQueuePaging(page, groupId);

PageInfo<TaskGroupQueue> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) taskGroupQueue.getTotal());
pageInfo.setTotalList(taskGroupQueue.getRecords());
pageInfo.setPaginationInfo((int) taskGroupQueue.getTotal(), taskGroupQueue.getRecords());

result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ private Map<String, Object> getStringObjectMap(int pageNo, int pageSize, Map<Str
PageInfo<TaskGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
int total = taskGroupPaging == null ? 0 : (int) taskGroupPaging.getTotal();
List<TaskGroup> list = taskGroupPaging == null ? new ArrayList<TaskGroup>() : taskGroupPaging.getRecords();
pageInfo.setTotal(total);
pageInfo.setTotalList(list);
pageInfo.setPaginationInfo(total, list);

result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ public Result queryTaskListPaging(User loginUser,
taskInstance.setExecutorName(user.getUserName());
}
}
pageInfo.setTotal((int) taskInstanceIPage.getTotal());
pageInfo.setTotalList(CollectionUtils.getListByExclusion(taskInstanceIPage.getRecords(), exclusionSet));
pageInfo.setPaginationInfo((int) taskInstanceIPage.getTotal(),
CollectionUtils.getListByExclusion(taskInstanceIPage.getRecords(), exclusionSet));
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ public Result<Object> queryUdfFuncListPaging(User loginUser, String searchVal, I
}
PageInfo<UdfFunc> pageInfo = new PageInfo<>(pageNo, pageSize);
IPage<UdfFunc> udfFuncList = getUdfFuncsPage(loginUser, searchVal, pageSize, pageNo);
pageInfo.setTotal((int) udfFuncList.getTotal());
pageInfo.setTotalList(udfFuncList.getRecords());
pageInfo.setPaginationInfo((int) udfFuncList.getTotal(), udfFuncList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ public Result<Object> queryUserList(User loginUser, String searchVal, Integer pa
IPage<User> scheduleList = userMapper.queryUserPaging(page, searchVal);

PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) scheduleList.getTotal());
pageInfo.setTotalList(scheduleList.getRecords());
pageInfo.setPaginationInfo((int) scheduleList.getTotal(), scheduleList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ public Result queryAllGroupPaging(User loginUser, Integer pageNo, Integer pageSi
}

PageInfo<WorkerGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal(total);
pageInfo.setTotalList(resultDataList);
pageInfo.setPaginationInfo(total, resultDataList);

result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ public PageInfo(Integer currentPage, Integer pageSize) {
this.currentPage = currentPage;
}

public void setPaginationInfo(Integer total, List<T> totalList) {
setTotal(total);
setTotalList(totalList);
if (total != null && total > 0 && this.pageSize > 0) {
this.totalPage = (int) Math.ceil((double) total / this.pageSize);
}
}

public static <T> PageInfo<T> of(IPage<T> iPage) {
PageInfo<T> pageInfo = new PageInfo<>((int) iPage.getCurrent(), (int) iPage.getSize());
pageInfo.setTotalList(iPage.getRecords());
pageInfo.setTotal((int) iPage.getTotal());
pageInfo.setPaginationInfo((int) iPage.getTotal(), iPage.getRecords());
return pageInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ public void testQueryRuleListPaging() throws Exception {
String end = "2020-01-02 00:00:00";

PageInfo<DqRule> pageInfo = new PageInfo<>(1, 10);
pageInfo.setTotal(10);
pageInfo.setTotalList(getRuleList());
pageInfo.setPaginationInfo(10, getRuleList());

when(dqRuleService.queryRuleListPaging(user, searchVal, ruleType, start, end, 1, 10)).thenReturn(pageInfo);

Expand Down

0 comments on commit 7323f87

Please sign in to comment.