package com.game.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.game.business.domain.AppGameLottery;
import com.game.business.mapper.AppGameLotteryMapper;
import com.game.business.service.IAppGameLotteryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppGameLotteryServiceImpl extends ServiceImpl<AppGameLotteryMapper, AppGameLottery> implements IAppGameLotteryService {

    @Autowired
    private AppGameLotteryMapper appGameLotteryMapper;

    @Override
    public long selectCount(Long classId, Long gameId, String gameDate) {
        LambdaQueryWrapper<AppGameLottery> queryLotteryWrapper = Wrappers.lambdaQuery();;
        queryLotteryWrapper.eq(AppGameLottery::getClassId, classId);
        queryLotteryWrapper.eq(AppGameLottery::getGameId, gameId);
        queryLotteryWrapper.eq(AppGameLottery::getGameDate, gameDate);
        return appGameLotteryMapper.selectCount(queryLotteryWrapper);
    }

    @Override
    public boolean save(AppGameLottery appGameLottery) {
        return appGameLotteryMapper.insert(appGameLottery) > 0;
    }
}
