package com.gyee.frame.service.impl.ticket;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.frame.model.ticket.Wfnode;
import com.gyee.frame.mapper.ticket.WfnodeMapper;
import com.gyee.frame.model.ticket.Wfprocess;
import com.gyee.frame.service.ticket.WfnodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.frame.service.ticket.WfprocessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenmh
 * @since 2020-07-21
 */
@Service
public class WfnodeServiceImpl extends ServiceImpl<WfnodeMapper, Wfnode> implements WfnodeService {

    @Override
    public List<Wfnode> getListNodes(String wfName, double version) {
        QueryWrapper<Wfnode> wrapper = new QueryWrapper<>();
        wrapper.eq("WFNAME", wfName);
        wrapper.eq("WFREVISION", version);

        List<Wfnode> wfnodes = baseMapper.selectList(wrapper);

        return wfnodes;
    }

    @Override
    public Wfnode getNode(double id, double version, String wfName) {
        QueryWrapper<Wfnode> wrapper = new QueryWrapper<>();
        wrapper.eq("ID", id);
        wrapper.eq("WFNAME", wfName);
        wrapper.eq("WFREVISION", version);

        Wfnode wfnode = baseMapper.selectOne(wrapper);

        return wfnode;
    }
}
