package com.artfess.bpm.persistence.manager.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.artfess.base.manager.impl.BaseManagerImpl;
import com.artfess.base.util.BeanUtils;
import com.artfess.bpm.persistence.dao.BpmExeStackRelationDao;
import com.artfess.bpm.persistence.manager.BpmExeStackRelationManager;
import com.artfess.bpm.persistence.model.BpmExeStackRelation;

import org.springframework.transaction.annotation.Transactional;

@Service("bpmExeStackRelationManager")
public class BpmExeStackRelationManagerImpl extends BaseManagerImpl<BpmExeStackRelationDao, BpmExeStackRelation> implements BpmExeStackRelationManager{

	@Override
	public BpmExeStackRelation getByToStackId(String stackId) {
		List<BpmExeStackRelation> list = baseMapper.getByToStackId(stackId);
		if(BeanUtils.isNotEmpty(list) && list.size()>0){
			return list.get(0);
		}
		return null;
	}

	@Override
	public BpmExeStackRelation getByFromStackId(String stackId) {
		return baseMapper.getByFromStackId(stackId);
	}

	@Override
	public List<BpmExeStackRelation> getListByProcInstId(String procInstId) {
		return baseMapper.getListByProcInstId(procInstId);
	}

	@Override
    @Transactional
	public void removeHisByInstId(String procInstId) {
		baseMapper.removeHisByInstId(procInstId);
	}

    @Override
    public BpmExeStackRelation getById(String instId,String fromId, String toId){
       return baseMapper.getById(instId, fromId, toId);
    }
    
    @Override
	public List<BpmExeStackRelation> getByToNodeId(String instId, String toNodeId) {
		return baseMapper.getByToNodeId(instId, toNodeId);
	}

}
