package com.aucma.dms.controller;

//import com.hw.common.core.utils.poi.ExcelUtil;
//import com.hw.common.core.web.controller.BaseController;
//import com.hw.common.core.web.domain.AjaxResult;
//import com.hw.common.core.web.page.TableDataInfo;
//import com.hw.common.log.annotation.Log;
//import com.hw.common.log.enums.BusinessType;
//import com.hw.common.security.annotation.RequiresPermissions;
//import com.aucma.dms.domain.DmsFlowCheckplan;
//import com.aucma.dms.service.IDmsFlowCheckplanService;

import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.core.page.TableDataInfo;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.dms.domain.DmsFlowCheckplan;
import com.aucma.dms.service.IDmsFlowCheckplanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

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

/**
 * 设备盘点计划Controller
 * 
 * @author xins
 * @date 2023-12-29
 */
@RestController
@RequestMapping("/dms/checkplan")
public class DmsFlowCheckplanController extends BaseController
{
    @Autowired
    private IDmsFlowCheckplanService dmsFlowCheckplanService;

    /**
     * 查询设备盘点计划列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:list')" )
    @GetMapping("/list")
    public TableDataInfo list(DmsFlowCheckplan dmsFlowCheckplan)
    {
        startPage();
        List<DmsFlowCheckplan> list = dmsFlowCheckplanService.selectDmsFlowCheckplanList(dmsFlowCheckplan);
        return getDataTable(list);
    }

    /**
     * 导出设备盘点计划列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:export')" )
    //@Log(title = "设备盘点计划", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DmsFlowCheckplan dmsFlowCheckplan)
    {
        List<DmsFlowCheckplan> list = dmsFlowCheckplanService.selectDmsFlowCheckplanList(dmsFlowCheckplan);
        ExcelUtil<DmsFlowCheckplan> util = new ExcelUtil<DmsFlowCheckplan>(DmsFlowCheckplan.class);
        util.exportExcel(response, list, "设备盘点计划数据");
    }

    /**
     * 获取设备盘点计划详细信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:query')" )
    @GetMapping(value = "/{flowCheckplanId}")
    public AjaxResult getInfo(@PathVariable("flowCheckplanId") Long flowCheckplanId)
    {
        return success(dmsFlowCheckplanService.selectDmsFlowCheckplanByFlowCheckplanId(flowCheckplanId));
    }

    /**
     * 新增设备盘点计划
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:add')" )
    //@Log(title = "设备盘点计划", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DmsFlowCheckplan dmsFlowCheckplan)
    {
        return toAjax(dmsFlowCheckplanService.insertDmsFlowCheckplan(dmsFlowCheckplan));
    }

    /**
     * 修改设备盘点计划
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:edit')" )
    //@Log(title = "设备盘点计划", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DmsFlowCheckplan dmsFlowCheckplan)
    {
        return toAjax(dmsFlowCheckplanService.updateDmsFlowCheckplan(dmsFlowCheckplan));
    }

    /**
     * 删除设备盘点计划
     */
    //@PreAuthorize("@ss.hasPermi('dms:checkplan:remove')" )
    //@Log(title = "设备盘点计划", businessType = BusinessType.DELETE)
	@DeleteMapping("/{flowCheckplanIds}")
    public AjaxResult remove(@PathVariable Long[] flowCheckplanIds)
    {
        return toAjax(dmsFlowCheckplanService.deleteDmsFlowCheckplanByFlowCheckplanIds(flowCheckplanIds));
    }
}
