package com.fzm.mall.server.front.goods.service.impl;

import com.fzm.mall.server.front.goods.model.FlashSale;
import com.fzm.mall.server.front.goods.mapper.FlashSaleMapper;
import com.fzm.mall.server.front.goods.model.vo.GoodsFlashVo;
import com.fzm.mall.server.front.goods.model.vo.PageVo;
import com.fzm.mall.server.front.goods.service.IFlashSaleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品秒杀活动表 服务实现类
 * </p>
 *
 * @author fzm
 * @since 2021-03-02
 */
@Service
public class FlashSaleServiceImpl extends ServiceImpl<FlashSaleMapper, FlashSale> implements IFlashSaleService {

    @Autowired
    private FlashSaleMapper flashSaleMapper;

    @Override
    public List<GoodsFlashVo> getlist(String merchantId, PageVo pageVo) {
        int start = (pageVo.getPage()-1)*pageVo.getSize();
        int end = pageVo.getPage()* pageVo.getSize();
        List<GoodsFlashVo> goodsFlashVos = flashSaleMapper.getList(merchantId,System.currentTimeMillis(),start,end);
        return goodsFlashVos;
    }
}
