package com.yunfeiyun.agmp.fms.controller;

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

import com.yunfeiyun.agmp.fms.domain.WmsChangeapplyitem;
import com.yunfeiyun.agmp.fms.service.IWmsChangeapplyitemService;
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.yunfeiyun.agmp.common.annotation.Log;
import com.yunfeiyun.agmp.common.core.controller.BaseController;
import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
import com.yunfeiyun.agmp.common.enums.BusinessType;
import com.yunfeiyun.agmp.common.utils.poi.ExcelUtil;
import com.yunfeiyun.agmp.common.core.page.TableDataInfo;

/**
 * 变动申请物件Controller
 * 
 * @author 杨晓辉
 * @date 2023-05-25
 */
@RestController
@RequestMapping("/wms/changeapplyitem")
public class WmsChangeapplyitemController extends BaseController
{
    @Autowired
    private IWmsChangeapplyitemService WmsChangeapplyitemService;

    /**
     * 查询变动申请物件列表
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:list')")
    @GetMapping("/list")
    public TableDataInfo list(WmsChangeapplyitem wmsChangeapplyitem)
    {
        startPage();
        List<WmsChangeapplyitem> list = WmsChangeapplyitemService.selectWmsChangeapplyitemList(wmsChangeapplyitem);
        return getDataTable(list);
    }

    /**
     * 导出变动申请物件列表
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:export')")
    @Log(title = "变动申请物件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsChangeapplyitem wmsChangeapplyitem)
    {
        List<WmsChangeapplyitem> list = WmsChangeapplyitemService.selectWmsChangeapplyitemList(wmsChangeapplyitem);
        ExcelUtil<WmsChangeapplyitem> util = new ExcelUtil<WmsChangeapplyitem>(WmsChangeapplyitem.class);
        util.exportExcel(response, list, "变动申请物件数据");
    }

    /**
     * 获取变动申请物件详细信息
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:query')")
    @GetMapping(value = "/{changeapplyitemId}")
    public AjaxResult getInfo(@PathVariable("changeapplyitemId") String changeapplyitemId)
    {
        return success(WmsChangeapplyitemService.selectWmsChangeapplyitemByChangeapplyitemId(changeapplyitemId));
    }

    /**
     * 新增变动申请物件
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:add')")
    @Log(title = "变动申请物件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WmsChangeapplyitem wmsChangeapplyitem)
    {
        return toAjax(WmsChangeapplyitemService.insertWmsChangeapplyitem(wmsChangeapplyitem));
    }

    /**
     * 修改变动申请物件
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:edit')")
    @Log(title = "变动申请物件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WmsChangeapplyitem wmsChangeapplyitem)
    {
        return toAjax(WmsChangeapplyitemService.updateWmsChangeapplyitem(wmsChangeapplyitem));
    }

    /**
     * 删除变动申请物件
     */
    @PreAuthorize("@ss.hasPermi('wms:changeapplyitem:remove')")
    @Log(title = "变动申请物件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{changeapplyitemIds}")
    public AjaxResult remove(@PathVariable String[] changeapplyitemIds)
    {
        return toAjax(WmsChangeapplyitemService.deleteWmsChangeapplyitemByChangeapplyitemIds(changeapplyitemIds));
    }
}
