package com.zg.project.Inventory.AutoInventory.controller;

import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.Inventory.AutoInventory.service.InventoryMatchScanService;
import com.zg.project.Inventory.domain.dto.MatchScanPageDTO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.zg.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/MatchScan")
public class InventoryMatchScanController extends BaseController {

    @Autowired
    private InventoryMatchScanService inventoryMatchScanService;

    /**
     * 分页查询盘点结果
     * @param dto
     * @return
     */
    @PostMapping("/historyList")
    @ApiOperation("分页查询盘点结果")
    public AjaxResult getHistoryList(@RequestBody MatchScanPageDTO dto) {
        return AjaxResult.success(inventoryMatchScanService.getHistoryList(dto));
    }

    /**
     * 分页查询盘点结果
     * @param dto
     * @return
     */
    @PostMapping("/taskNameHistory")
    @ApiOperation("分页查询盘点结果")
    public AjaxResult getByTaskName(@RequestBody MatchScanPageDTO dto) {

        startPage();

        List<InventoryMatchScanVO> list = inventoryMatchScanService.getByTaskName(dto);

        return AjaxResult.success(getDataTable(list));

    }
}
