package com.aucma.dms.controller;

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.DmsBaseInspectStandard;
import com.aucma.dms.service.IDmsBaseInspectStandardService;
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 Open Platform
 * @date 2024-01-17
 */
@RestController
@RequestMapping("/dms/dmsBaseInspectStandard")
public class DmsBaseInspectStandardController extends BaseController
{
    @Autowired
    private IDmsBaseInspectStandardService dmsBaseInspectStandardService;

    /**
     * 查询巡检标准信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:list')" )
    @GetMapping("/list")
    public TableDataInfo list(DmsBaseInspectStandard dmsBaseInspectStandard)
    {
        startPage();
        List<DmsBaseInspectStandard> list = dmsBaseInspectStandardService.selectDmsBaseInspectStandardList(dmsBaseInspectStandard);
        return getDataTable(list);
    }

    /**
     * 导出巡检标准信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:export')" )
    ////@Log(title = "巡检标准信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DmsBaseInspectStandard dmsBaseInspectStandard)
    {
        List<DmsBaseInspectStandard> list = dmsBaseInspectStandardService.selectDmsBaseInspectStandardList(dmsBaseInspectStandard);
        ExcelUtil<DmsBaseInspectStandard> util = new ExcelUtil<DmsBaseInspectStandard>(DmsBaseInspectStandard.class);
        util.exportExcel(response, list, "巡检标准信息数据");
    }

    /**
     * 获取巡检标准信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:query')" )
    @GetMapping(value = "/{inspectStandardId}")
    public AjaxResult getInfo(@PathVariable("inspectStandardId") Long inspectStandardId)
    {
        return success(dmsBaseInspectStandardService.selectDmsBaseInspectStandardByInspectStandardId(inspectStandardId));
    }

    /**
     * 新增巡检标准信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:add')" )
    ////@Log(title = "巡检标准信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DmsBaseInspectStandard dmsBaseInspectStandard)
    {
        return toAjax(dmsBaseInspectStandardService.insertDmsBaseInspectStandard(dmsBaseInspectStandard));
    }

    /**
     * 修改巡检标准信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:edit')" )
    ////@Log(title = "巡检标准信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DmsBaseInspectStandard dmsBaseInspectStandard)
    {
        return toAjax(dmsBaseInspectStandardService.updateDmsBaseInspectStandard(dmsBaseInspectStandard));
    }

    /**
     * 删除巡检标准信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsBaseInspectStandard:remove')" )
    ////@Log(title = "巡检标准信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{inspectStandardIds}")
    public AjaxResult remove(@PathVariable Long[] inspectStandardIds)
    {
        return toAjax(dmsBaseInspectStandardService.deleteDmsBaseInspectStandardByInspectStandardIds(inspectStandardIds));
    }
}
