package com.fjhx.wms.controller.monthly;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.wms.entity.monthly.dto.MonthlyInventoryReportSelectDto;
import com.fjhx.wms.entity.monthly.vo.MonthlyInventoryReportVo;
import com.fjhx.wms.service.monthly.MonthlyInventoryReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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


/**
 * <p>
 * 月度库存报表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-07-05
 */
@RestController
@RequestMapping("/monthlyInventoryReport")
public class MonthlyInventoryReportController {

    @Autowired
    private MonthlyInventoryReportService monthlyInventoryReportService;

    /**
     * 月度库存报表分页
     */
    @PostMapping("/page")
    public Page<MonthlyInventoryReportVo> page(@RequestBody MonthlyInventoryReportSelectDto dto) {
        return monthlyInventoryReportService.getPage(dto);
    }

    /**
     * 获取日报已有年份列表
     */
    @GetMapping("/getYearList")
    public List<String> getYearList() {
        return monthlyInventoryReportService.getYearList();
    }

    /**
     * Excel导出
     */
    @PostMapping("/exportExcel")
    public void exportExcel(@RequestBody MonthlyInventoryReportSelectDto dto, HttpServletResponse httpServletResponse) {
        monthlyInventoryReportService.exportExcel(dto, httpServletResponse);
    }

}
