package com.qmth.sop.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.sop.business.bean.result.TFFlowLogResult;
import com.qmth.sop.business.entity.TFFlowLog;
import com.qmth.sop.common.enums.FlowApproveOperationEnum;

import java.util.List;

/**
 * <p>
 * 流程流水表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2023-07-17
 */
public interface TFFlowLogService extends IService<TFFlowLog> {

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

    /**
     * 查询最后一条日志审批记录
     *
     * @param flowId
     * @return
     */
    TFFlowLog findByLastFlowLog(Long flowId);

    /**
     * 查询最后一条日志审批记录(带审批状态)
     *
     * @param flowId
     * @return
     */
    TFFlowLog findByLastFlowLog(Long flowId, FlowApproveOperationEnum approveOperation);

    /**
     * 查询最后一条日志审批记录
     *
     * @param flowId
     * @return
     */
    String findByLastFlowLogApproveUser(Long flowId);

    /**
     * 根据taskId和approveOperation查询最后一条日志审批记录
     *
     * @param taskId
     * @param approveOperation
     * @return
     */
    TFFlowLog findByLastFlowLogByTaskId(Long taskId, FlowApproveOperationEnum approveOperation);

    /**
     * 根据flowId查找最后一条
     *
     * @param flowId
     * @return
     */
    TFFlowLog findByLastFlowLogByFlowId(Long flowId);
}
