package thyyxxk.webserver.controller.reports;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
import thyyxxk.webserver.entity.querydata.ConsumablesStatistics;
import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
import thyyxxk.webserver.service.reports.ConsumablesStatisticsService;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 描述查询
 * </p>
 *
 * @author xc
 * @date 2021-04-06 14:33
 */
@RestController
@RequestMapping("/consumablesStatistics")
public class ConsumablesStatisticsController {
    private final ConsumablesStatisticsService service;

    @Autowired
    public ConsumablesStatisticsController(ConsumablesStatisticsService service) {
        this.service = service;
    }

    @PostMapping("/queryConsumables")
    public ResultVo<List<ConsumablesStatistics>> query(@RequestBody ConsumablesStatistics param) {
        return service.query(param);
    }

    @PassToken
    @PostMapping("/exportExcel")
    public void exportExcel(HttpServletResponse response,
                            @RequestBody @Validated ConsumablesStatistics param) {
        service.exportExcel(response, param);
    }

    @GetMapping("/getDropdownBox")
    public ResultVo<List<GetDropdownBox>> getDropdownBox() {
        return service.getDropdownBox();
    }

}
