package com.lz.modules.flow.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.flow.dao.FlowMapper;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.flow.entity.FlowChart;
import com.lz.modules.flow.service.FlowChartService;
import com.lz.modules.flow.service.FlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
* 流转表 服务类
* </p>
*
* @author quyixiao
* @since 2020-08-18
*/

@Service
public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements FlowService {


    @Autowired
	private FlowMapper flowMapper;


    @Autowired
	private FlowChartService flowChartService;


	@Override
	public Flow selectFlowById(Long id){
		return flowMapper.selectFlowById(id);
	}



	@Override
	public Long insertFlow(Flow flow){
		return flowMapper.insertFlow(flow);
	}



	@Override
	public int updateFlowById(Flow flow){
		return flowMapper.updateFlowById(flow);
	}



	@Override
	public int updateCoverFlowById(Flow flow){
		return flowMapper.updateCoverFlowById(flow);
	}



	@Override
	public int deleteFlowById(Long id){
		return flowMapper.deleteFlowById(id);
	}

    @Override
    public List<Flow> selectByFlowId(Long flowId,Long startId) {
        return flowMapper.selectByFlowId(flowId,startId);
    }

	@Override
	public FlowChart selectFlowChartByChartId(Long flowId) {
		Flow flow = flowMapper.selectFlowById(flowId);
		FlowChart flowChart = flowChartService.selectFlowChartById(flow.getChartId());
		return flowChart;
	}

	@Override
	public FlowChart selectFlowChartByFlow(Flow flow){
		FlowChart flowChart = flowChartService.selectFlowChartById(flow.getChartId());
		return flowChart;
	}



}
