package com.izouma.zhirongip.web;

import com.izouma.zhirongip.service.StatisticService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/statistic")
@AllArgsConstructor
public class StatisticController {
    private final StatisticService statisticService;

    @PostMapping("/getTotal")
    public Map<String, Long> getTotal() {
        return statisticService.getTotal();
    }

    /*
    0 周
    1 月
    2 年
     */
    @PostMapping("/getDemand")
    public Map<Object, Long> getDemand(int type) {
        return statisticService.getDemand(type);
    }
    /*
    0 周
    1 月
    2 年
     */
    @PostMapping("/getSupply")
    public Map<Object, Long> getSupply(int type) {
        return statisticService.getSupply(type);
    }
}
