package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsImportResult;
import com.ruoyi.system.service.IWmsImportResultService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 成品查询结果(数据同步)Controller
 * 
 * @author ruoyi
 * @date 2025-06-19
 */
@RestController
@RequestMapping("/warehouse/WmsImportResult")
public class WmsImportResultController extends BaseController
{
    @Autowired
    private IWmsImportResultService wmsImportResultService;

    /**
     * 查询成品查询结果(数据同步)列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:list')")
    @GetMapping("/list")
    public TableDataInfo list(WmsImportResult wmsImportResult)
    {
        startPage();
        List<WmsImportResult> list = wmsImportResultService.selectWmsImportResultList(wmsImportResult);
        return getDataTable(list);
    }

    /**
     * 导出成品查询结果(数据同步)列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:export')")
    @Log(title = "成品查询结果(数据同步)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsImportResult wmsImportResult)
    {
        List<WmsImportResult> list = wmsImportResultService.selectWmsImportResultList(wmsImportResult);
        ExcelUtil<WmsImportResult> util = new ExcelUtil<WmsImportResult>(WmsImportResult.class);
        util.exportExcel(response, list, "成品查询结果(数据同步)数据");
    }

    /**
     * 获取成品查询结果(数据同步)详细信息
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:query')")
    @GetMapping(value = "/detail")
    public AjaxResult getInfo(@RequestParam("model") String model)
    {
        return success(wmsImportResultService.selectWmsImportResultByModel(model));
    }

    /**
     * 新增成品查询结果(数据同步)
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:add')")
    @Log(title = "成品查询结果(数据同步)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WmsImportResult wmsImportResult)
    {
        return toAjax(wmsImportResultService.insertWmsImportResult(wmsImportResult));
    }

    /**
     * 修改成品查询结果(数据同步)
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:edit')")
    @Log(title = "成品查询结果(数据同步)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WmsImportResult wmsImportResult)
    {
        return toAjax(wmsImportResultService.updateWmsImportResult(wmsImportResult));
    }

    /**
     * 删除成品查询结果(数据同步)
     */
    @PreAuthorize("@ss.hasPermi('warehouse:WmsImportResult:remove')")
    @Log(title = "成品查询结果(数据同步)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{models}")
    public AjaxResult remove(@PathVariable String[] models)
    {
        return toAjax(wmsImportResultService.deleteWmsImportResultByModels(models));
    }
}
