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

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

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

@Repository
public interface IWorkflowNodeDefinitionRepository extends IBaseRepository<WorkflowNodeDefinition, Long> {
    
    /**
     * 查询所有启用的节点定义，按排序号排序
     */
    List<WorkflowNodeDefinition> findByEnabledTrue();
    
    /**
     * 根据分类查询启用的节点定义
     */
    List<WorkflowNodeDefinition> findByEnabledTrueAndCategory(String category);
    
    /**
     * 根据类型查询节点定义
     */
    Optional<WorkflowNodeDefinition> findByNodeTypeAndEnabledTrue(String type);
    
    /**
     * 检查类型是否存在
     */
    boolean existsByNodeTypeAndDeletedFalse(String type);
} 