package com.fjhx.form.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.form.entity.ProductionReportBo;
import com.fjhx.form.entity.ProductionReportSelectDto;
import com.fjhx.form.entity.SaleReportBo;
import com.fjhx.form.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/report")
public class ReportController {

    private final ReportService reportService;

    @Autowired
    public ReportController(ReportService reportService) {
        this.reportService = reportService;
    }

    /**
     * 生产端报表
     */
    @PostMapping("/productionReport")
    Page<ProductionReportBo> productionReport(@RequestBody ProductionReportSelectDto dto) {
        return reportService.productionReport(dto);
    }

    /**
     * 业务端报表
     */
    @PostMapping("/saleReport")
    Page<SaleReportBo> saleReport(@RequestBody ProductionReportSelectDto dto) {
        return reportService.saleReport(dto);
    }

}
