This commit is contained in:
asp_ly 2024-12-17 21:50:52 +08:00
parent 3374885ce2
commit 9ddb1dc6cf
2 changed files with 2 additions and 2 deletions

View File

@ -25,6 +25,6 @@ public interface IWorkflowInstanceRepository extends IBaseRepository<WorkflowIns
List<WorkflowInstance> findTop1ByWorkflowDefinitionIdOrderByCreateTimeDesc(Long workflowDefinitionId);
Page<WorkflowInstance> findByWorkflowDefinitionId(Long workflowDefinitionId, Pageable pageable);
Page<WorkflowInstance> findByWorkflowDefinitionIdOrderByCreateTimeDesc(Long workflowDefinitionId, Pageable pageable);
}

View File

@ -212,7 +212,7 @@ public class WorkflowInstanceServiceImpl extends BaseServiceImpl<WorkflowInstanc
@Override
public Page<WorkflowHistoricalInstancesDTO> historicalInstances(WorkflowHistoricalInstancesQuery query) {
Pageable pageable = PageRequest.of(query.getPageNum(), query.getPageSize());
Page<WorkflowInstance> workflowInstances = workflowInstanceRepository.findByWorkflowDefinitionId(query.getWorkflowDefinitionId(), pageable);
Page<WorkflowInstance> workflowInstances = workflowInstanceRepository.findByWorkflowDefinitionIdOrderByCreateTimeDesc(query.getWorkflowDefinitionId(), pageable);
List<WorkflowHistoricalInstancesDTO> result = new ArrayList<>();
workflowInstances.getContent().stream().map(workflowInstance -> {
WorkflowHistoricalInstancesDTO workflowHistoricalInstancesDTO = workflowInstanceConverter.toWorkflowHistoricalInstancesDTO(workflowInstance);