stalary commented on code in PR #11522:
URL: https://github.com/apache/dolphinscheduler/pull/11522#discussion_r947983844
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java:
##########
@@ -780,24 +780,36 @@ public Map<String, Object> viewGantt(long projectCode,
Integer processInstanceId
ganttDto.setTaskNames(nodeList);
List<Task> taskList = new ArrayList<>();
- for (String node : nodeList) {
- TaskInstance taskInstance =
-
taskInstanceMapper.queryByInstanceIdAndCode(processInstanceId,
Long.parseLong(node));
- if (taskInstance == null) {
- continue;
+ if (!nodeList.isEmpty()) {
+ List<Long> taskCodes =
nodeList.stream().map(Long::parseLong).collect(Collectors.toList());
+ List<TaskInstance> taskInstances =
taskInstanceMapper.queryByInstanceIdsAndCodes(
+ Collections.singletonList(processInstanceId), taskCodes
+ );
+ for (String node : nodeList) {
+ TaskInstance taskInstance = null;
+ for (TaskInstance instance : taskInstances) {
Review Comment:
Same as above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]