package com.qmth.distributed.print.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qmth.distributed.print.business.bean.dto.approvalForm.ApprovalInfo;
import com.qmth.distributed.print.business.bean.result.TFFlowLogResult;
import com.qmth.distributed.print.business.entity.TFFlowLog;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 流程流水表 Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2021-08-02
 */
public interface TFFlowLogMapper extends BaseMapper<TFFlowLog> {

    /**
     * 根据流程id查询流程状态
     *
     * @param flowId
     * @param schoolId
     * @return
     */
    List<TFFlowLog> findByFlowId(@Param("flowId") Long flowId, @Param("schoolId") Long schoolId);

    /**
     * 根据实体id查询
     *
     * @param objectId
     * @return
     */
    List<TFFlowLogResult> findByObjectId(@Param("objectId") Long objectId);

    /**
     * 查找最后一条审批记录
     *
     * @param flowId
     * @param schoolId
     * @param approveOperation
     * @return
     */
    TFFlowLog findByLast(@Param("flowId") Long flowId, @Param("schoolId") Long schoolId, @Param("approveOperation") String approveOperation);

    /**
     * 根据流程id查询审批表
     *
     * @param flowId 流程id
     * @return 审批表
     */
    List<ApprovalInfo> findApprovalInfoByFlowId(@Param("flowId") Long flowId);
}
