package com.fjhx.victoriatourist.controller.sales;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.sales.dto.SalesRecordSelectDto;
import com.fjhx.victoriatourist.entity.sales.vo.SalesRecordVo;
import com.fjhx.victoriatourist.service.sales.SalesRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


/**
 * <p>
 * 销售数据 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-19
 */
@RestController
@RequestMapping("/salesRecord")
public class SalesRecordController {

    @Autowired
    private SalesRecordService salesRecordService;

    /**
     * 销售数据分页
     */
    @PostMapping("/page")
    public Page<SalesRecordVo> page(@RequestBody SalesRecordSelectDto dto) {
        return salesRecordService.getPage(dto);
    }

    /**
     * 导入excel数据
     */
    @PostMapping("/excelImport")
    public void excelImport(@RequestParam("file") MultipartFile file, @RequestParam("warehouseId") Long warehouseId) {
        salesRecordService.excelImport(file, warehouseId);
    }

}
