package com.fs.company.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.company.domain.CompanyWorkflow;
import com.fs.company.domain.CompanyWorkflowNode;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * AI工作流节点Mapper接口
 *
 * @author fs
 * @date 2026-01-06
 */
public interface CompanyWorkflowNodeMapper extends BaseMapper<CompanyWorkflowNode> {

    CompanyWorkflowNode selectCompanyWorkflowNodeById(Long nodeId);

    List<CompanyWorkflowNode> selectCompanyWorkflowNodeByWorkflowId(Long workflowId);

    /**
     * 根据工作流ID和节点类型列表查询节点
     */
    List<CompanyWorkflowNode> selectNodesByWorkflowIdAndTypes(@Param("workflowId") Long workflowId,
                                                           @Param("nodeTypes") List<String> nodeTypes);

    Integer insertCompanyWorkflowNode(CompanyWorkflowNode node);

    Integer batchInsertCompanyWorkflowNode(List<CompanyWorkflowNode> nodes);

    Integer updateCompanyWorkflowNode(CompanyWorkflowNode node);

    Integer deleteCompanyWorkflowNodeById(Long nodeId);

    Integer deleteCompanyWorkflowNodeByWorkflowId(Long workflowId);

    CompanyWorkflowNode selectNodeByWorkflowIdAndNodeKey(@Param("workflowId") Long workflowId,
                                                       @Param("nodeKey") String nodeKey);
    CompanyWorkflowNode selectNodeByNodeKey(@Param("nodeKey") String nodeKey);
}
