package com.izouma.nineth.repo;

import com.alibaba.fastjson.JSONObject;
import com.izouma.nineth.ApplicationTests;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import java.util.Map;


public class OrderRepoTest extends ApplicationTests {

    @Autowired
    private OrderRepo        orderRepo;
    @Autowired
    private TokenHistoryRepo tokenHistoryRepo;

    @Test
    public void sumPrice() {
//        System.out.println(orderRepo.sumPrice());
        List<Object[]> objects = orderRepo.sumPrice();
        System.out.println(JSONObject.toJSON(objects));
    }

    @Test
    public void sumPrice1() {
        List<Map<String, Object>> objects = tokenHistoryRepo.sumPrice(LocalDateTime.of(LocalDate.of(2022, 3, 1), LocalTime.MIN),
                LocalDateTime.now(), 3);
        System.out.println(JSONObject.toJSONString(objects));
    }
}