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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gyee.frame.common.ticket.TicketUtil;
import com.gyee.frame.model.ticket.Workticket;
import com.gyee.frame.mapper.ticket.WorkticketMapper;
import com.gyee.frame.service.ticket.WorkticketService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenmh
 * @since 2020-06-01
 */
@Service
public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Workticket> implements WorkticketService {


    @Override
    public IPage<Workticket> selectPage(long pageNum, String type) {
        String ticketType = TicketUtil.ticketType(type);
        QueryWrapper<Workticket> wrapper = new QueryWrapper();

        wrapper.eq("WTICKETTYPE", ticketType);
        wrapper.orderByDesc("ID");

        Page<Workticket> page = new Page<>(pageNum, 15);
        IPage<Workticket> iPage = baseMapper.selectPage(page, wrapper);

        return iPage;
    }
}
