package com.hzs.bonus.order.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.hzs.bonus.order.mapper.BonusOrderMapper;
import com.hzs.bonus.order.service.IBonusOrderService;
import com.hzs.common.domain.sale.ext.SaOrderExt;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.*;

@Service
public class BonusOrderServiceImpl implements IBonusOrderService {

    @Resource
    private BonusOrderMapper bonusOrderMapper;

    @Override
    public List<SaOrderExt> querySaOrderByTime(Date startDate, Date endDate, String orderCode) {
        return bonusOrderMapper.querySaOrderByTime(startDate, endDate, orderCode);
    }

    @Override
    public SaOrderExt querySaOrderByDay(Date startDate, Date endDate, String orderCode) {
        List<SaOrderExt> saOrderList = bonusOrderMapper.querySaOrderByTime(startDate, endDate, orderCode);
        if (CollectionUtil.isNotEmpty(saOrderList)) {
            return saOrderList.get(0);
        }
        return null;
    }
}
