/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.workflow.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codvision.workflow.entity.WorkFlowRecord;
import com.codvision.workflow.entity.vo.WorkFlowRecordVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author hxl
 */
public interface WorkFlowRecordMapper extends BaseMapper<WorkFlowRecord> {

    /**
     * 通用查询
     * @param paraMap 查询条件
     * @return 列表
     */
    List<WorkFlowRecordVO> findAll(@Param("query") Map<String, Object> paraMap);

    /**
     * 根据任务ID获取信息
     * @param taskId 任务ID
     * @return 当前正在执行的任务记录
     */
    WorkFlowRecord getByTodoTaskId(String taskId);

    /**
     * 根据流程实例ID、活动ID和任务ID删除当前还未操作的记录
     * @param instanceId 流程实例ID
     * @param activityId 流程活动ID
     * @param taskIds 任务ID
     */
    void delByInstanceIdAndActivityIdAndTaskIds(@Param("instanceId") String instanceId, @Param("activityId") String activityId, @Param("taskIds") List<String> taskIds);

    /**
     * 批量添加
     * @param records 数据
     */
    void insertBatch(List<WorkFlowRecord> records);

}
