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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.frame.model.ticket.Wfprocess;
import com.gyee.frame.mapper.ticket.WfprocessMapper;
import com.gyee.frame.service.ticket.WfprocessService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenmh
 * @since 2020-07-21
 */
@Service
public class WfprocessServiceImpl extends ServiceImpl<WfprocessMapper, Wfprocess> implements WfprocessService {

    @Override
    public Wfprocess activeVersion(String wfName) {
        QueryWrapper<Wfprocess> wrapper = new QueryWrapper<>();
        wrapper.eq("WFNAME", wfName);
        wrapper.eq("ACTIVE", "是");

        Wfprocess wfprocess = baseMapper.selectOne(wrapper);

        if (wfprocess == null)
            throw new RuntimeException();

        return wfprocess;
    }
}
