From ea268d60317c8dffb9f19c32452b841db5df24b5 Mon Sep 17 00:00:00 2001 From: "veli.yang" <897900564@qq.com> Date: Sat, 12 Oct 2024 08:54:03 +0800 Subject: [PATCH] [Fix-16680][ApiServer] Query project list paging error (#16681) --- .../api/service/impl/ProjectServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java index 3cab05aa77..ef36d95145 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java @@ -391,13 +391,18 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic project.setPerm(Constants.DEFAULT_ADMIN_PERMISSION); } } + if (CollectionUtils.isEmpty(projectList)) { + result.setData(pageInfo); + putMsg(result, Status.SUCCESS); + return result; + } List userList = userMapper.selectByIds(projectList.stream() .map(Project::getUserId).distinct().collect(Collectors.toList())); Map userMap = userList.stream().collect(Collectors.toMap(User::getId, User::getUserName)); - List projectWorkflowDefinitionCountList = - workflowDefinitionMapper.queryProjectWorkflowDefinitionCountByProjectCodes( - projectList.stream().map(Project::getCode).distinct().collect(Collectors.toList())); - Map projectWorkflowDefinitionCountMap = projectWorkflowDefinitionCountList.stream() + List projectCodes = projectList.stream().map(Project::getCode).distinct().collect(Collectors.toList()); + Map projectWorkflowDefinitionCountMap = workflowDefinitionMapper + .queryProjectWorkflowDefinitionCountByProjectCodes(projectCodes) + .stream() .collect(Collectors.toMap(ProjectWorkflowDefinitionCount::getProjectCode, ProjectWorkflowDefinitionCount::getCount)); for (Project project : projectList) {