package com.aucma.report.controller;

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

import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.report.domain.ProductOffLine;
import com.aucma.report.service.IProductOffLineService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;

/**
 * 扫描下线记录报表Controller
 *
 * @author Yinq
 * @date 2024-03-05
 */
@RestController
@RequestMapping("/report/productOffLine")
public class ProductOffLineController extends BaseController {
    @Autowired
    private IProductOffLineService productOffLineService;

    /**
     * 查询扫描下线记录报表列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ProductOffLine productOffLine) {
        startPage();
        List<ProductOffLine> list = productOffLineService.selectProductOffLineList(productOffLine);
        return getDataTable(list);
    }

    /**
     * 导出扫描下线记录报表列表
     */
    @Log(title = "扫描下线记录报表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProductOffLine productOffLine) {
        List<ProductOffLine> list = productOffLineService.selectProductOffLineList(productOffLine);
        ExcelUtil<ProductOffLine> util = new ExcelUtil<ProductOffLine>(ProductOffLine.class);
        util.exportExcel(response, list, "扫描下线记录报表数据");
    }

}
