package com.hzs.activity.ticket.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.activity.ticket.mapper.AcTicketMapper;
import com.hzs.activity.ticket.service.IAcTicketService;
import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.domain.activity.ticket.AcTicket;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 门票 服务实现类
 */
@Service
public class AcTicketServiceImpl extends ServiceImpl<AcTicketMapper, AcTicket> implements IAcTicketService {

    @Override
    public AcTicket queryAcTicketByPkId(Long pkTicket) {
        LambdaQueryWrapper<AcTicket> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AcTicket::getPkId, pkTicket);
        queryWrapper.le(AcTicket::getDisStartDate, DateUtils.currentDateTime());
        queryWrapper.ge(AcTicket::getDisEndDate, DateUtils.currentDateTime());
        return baseMapper.selectOne(queryWrapper);
    }

    @Override
    public List<AcTicket> listTicket(Date queryDate, Long pkVertex, Integer pkCountry) {
        return baseMapper.listTicket(queryDate, pkVertex, pkCountry);
    }
}
