package com.lz.modules.flow.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.entity.model.BasePage;
import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.performance.req.AssessTaskReq;
import com.lz.modules.sys.entity.app.ResultRecord;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* <p>
* 流转记录表 服务类
* </p>
*
* @author quyixiao
* @since 2020-08-18
*/
public interface FlowRecordService extends IService<FlowRecord> {



	FlowRecord selectFlowRecordById(Long id);


	Long insertFlowRecord(FlowRecord flowRecord);


	int updateFlowRecordById(FlowRecord flowRecord);


	int updateCoverFlowRecordById(FlowRecord flowRecord);


	int deleteFlowRecordById(Long id);


    FlowRecord selectLastFlowRecordByRecordId(Long recordResultId);

    FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId);

    List<FlowRecord> selectFlowRecordByRecordId(Long recordId);

	void initFlowRecord(ResultRecord resultRecord , Long roleId , Integer type , String name);

	List<FlowRecord> selectFlowRecordByResultRecordIdFlowId(Long recordResultId);

	List<FlowRecord> selectFlowRecordByFlowId(Long recordId);

	FlowRecord selectLastFlowNoStatusRecordByRecordId(Long resultRecordId);

	List<FlowRecord> selectFlowRecordByResultRecordIdType(Long recordResultId, Integer type);

	List<FlowRecord> selectFlowRecordByResultRecordIdTypeStatus(Long recordResultId, Integer type, int status);

	Long copyFlowRecord(FlowRecord flowRecord);

	PageUtils selectTaskListByApprovalStaffId(AssessTaskReq req, Long approvalStaffId);

    void insertFlowRecords(List<FlowRecord> flowRecords);

	List<FlowRecord> selectFlowRecordByRecordIdStatus(Long resultRecordId,Integer status);

	FlowRecord selectFlowRecordByRecordIdAndFlowId(Long resultRecordId, Long id);

	List<FlowRecord> selectFlowRecordByRecordIdStatusFlowIndex(Long resultRecordId, int status, int flowIndex);


	FlowRecord selectPreFlowRecordByRecordIdMaxIdStatus(Long resultRecordId, Long id, int status);

	List<FlowRecord> selectFlowRecordByRecordIdFlowIndex(Long resultRecordId, Integer flowIndex);

	List<FlowRecord> selectFlowRecordByResultRecordId(Long resultRecordId);

    FlowRecord selectFlowRecordByRecordIdMinIdStatus(Long resultRecordId, Long id, int i);

    List<FlowRecord> selectFlowRecordByRecordIdFlowProcess(Long id, int flowProcess);
	//获取同一个节点下面的或签，或者会签
    List<FlowRecord> selectAndOrFlowRecordsById(Long flowRecordId, Long recordId);
	//获取最后流程同一个小节点的所有数据
	List<FlowRecord> selectLastFlowRecordsById(Long recordId);
	//获取制定步骤一个小节点的所有数据
	List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);

	List<FlowRecord> selectSkipFlowRecordsById(Long recordId);

	List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);

    List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status);

	List<FlowRecord> selectFlowRecordByRecordIdGeFlowIndex(Long recordId, Integer flowIndex);

	void deleteFlowRecordByRecordId(Long recordId);

	void updateFlowRecordIdById(Long id, Long newId);

	FlowRecord selectPreFlowRecordByRecordIdMinIdStatusList(Long recordId, Integer flowIndex, List<Integer> statusList);

	List<FlowRecord> selectFlowRecordByRecordIdFlowIndexStatusList(Long recordId, Integer flowIndex, List<Integer> statusList);

	List<FlowRecord> selectFlowRecordByRecordIdLeFlowIndex(Long resultRecordId, Integer flowIndex);

    List<FlowRecord> selectFlowRecordByRecordIdsFlowProcess(List<Long> recordIds, Long flowProcess);

	List<FlowRecord> selectFlowRecordByRecordIdsStatus(List<Long> recordIds, int status);
}