package com.qqchen.deploy.backend.workflow.repository;

import com.qqchen.deploy.backend.framework.repository.IBaseRepository;
import com.qqchen.deploy.backend.workflow.entity.WorkflowNodeInstance;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface IWorkflowNodeInstanceRepository extends IBaseRepository<WorkflowNodeInstance, Long> {
    Optional<WorkflowNodeInstance> findByProcessInstanceIdAndExecutionId(String processInstanceId, String executionId);

    List<WorkflowNodeInstance> findByProcessInstanceId(String processInstanceId);

    WorkflowNodeInstance findByNodeId(String nodeId);

    WorkflowNodeInstance findByProcessInstanceIdAndNodeId(String processInstanceId, String nodeId);

    List<WorkflowNodeInstance> findByWorkflowInstanceId(Long workflowInstanceId);

    WorkflowNodeInstance findTop1ByProcessInstanceIdOrderByStartTimeDesc(String processInstanceId);
}
