package com.izouma.dingdong.repo;

import com.izouma.dingdong.repo.merchant.SalesRepo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.LocalDate;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
public class SalesRepoTest {
    @Autowired
    private SalesRepo salesRepo;

    @Test
    public void testRenqi() {
//        List<Sales> sales = salesRepo.findByGoodsIdAndPopularityGreaterThanEqual(57L, 5);

//        System.out.println(salesRepo.findByGoodsIdAndDayAndPopularityGreaterThanEqual(57l, LocalDate.now().plusDays(-1), 5));

    }

    @Test
    public void test() {
        LocalDate of = LocalDate.of(2020, 7, 1);
        //System.out.println(of);
        //System.out.println(of.minusMonths(1));
        System.out.println(salesRepo.findAllByGoodsIdAndDayBetween(607L, of.minusMonths(1), of).size());
    }
}
