Copilot commented on code in PR #17163:
URL: 
https://github.com/apache/dolphinscheduler/pull/17163#discussion_r2081313119


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowInstanceServiceImpl.java:
##########
@@ -1020,64 +1021,44 @@ public Map<String, Object> viewGantt(long projectCode, 
Integer workflowInstanceI
      * query workflow instance by workflowDefinitionCode and stateArray
      *
      * @param workflowDefinitionCode workflowDefinitionCode
-     * @param states                states array
+     * @param states                 states array
      * @return workflow instance list
      */
     @Override
     public List<WorkflowInstance> queryByWorkflowDefinitionCodeAndStatus(Long 
workflowDefinitionCode, int[] states) {
-        return 
workflowInstanceMapper.queryByWorkflowDefinitionCodeAndStatus(workflowDefinitionCode,
 states);
+        return workflowInstanceDao.queryByCondition(
+                queryWrapper -> 
queryWrapper.eq(WorkflowInstance::getWorkflowDefinitionCode, 
workflowDefinitionCode)
+                        .in(WorkflowInstance::getState, 
Arrays.stream(states).boxed().collect(Collectors.toList())));
     }
 
     @Override
     public List<WorkflowInstance> queryByWorkflowCodeVersionStatus(Long 
workflowDefinitionCode,
                                                                    int 
workflowDefinitionVersion, int[] states) {
-        return 
workflowInstanceDao.queryByWorkflowCodeVersionStatus(workflowDefinitionCode, 
workflowDefinitionVersion,
-                states);
+        return workflowInstanceDao.queryByCondition(
+                queryWrapper -> 
queryWrapper.eq(WorkflowInstance::getWorkflowDefinitionCode, 
workflowDefinitionCode)
+                        .eq(WorkflowInstance::getWorkflowDefinitionVersion, 
workflowDefinitionVersion)
+                        .in(WorkflowInstance::getState, states));

Review Comment:
   For consistency with other queries that convert primitive int arrays to 
boxed Lists (e.g., queryByWorkflowDefinitionCodeAndStatus), consider converting 
'states' to a List<Integer> before using the 'in' clause.
   ```suggestion
                           .in(WorkflowInstance::getState, 
Arrays.stream(states).boxed().collect(Collectors.toList())));
   ```



-- 
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]

Reply via email to