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.DmsBaseDeviceDepreciation;
//import com.aucma.dms.service.IDmsBaseDeviceDepreciationService;

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.DmsBaseDeviceDepreciation;
import com.aucma.dms.service.IDmsBaseDeviceDepreciationService;
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-27
 */
@RestController
@RequestMapping("/dms/devicedepreciation")
public class DmsBaseDeviceDepreciationController extends BaseController
{
    @Autowired
    private IDmsBaseDeviceDepreciationService dmsBaseDeviceDepreciationService;

    /**
     * 查询设备折旧信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:list')" )
    @GetMapping("/list")
    public TableDataInfo list(DmsBaseDeviceDepreciation dmsBaseDeviceDepreciation)
    {
        startPage();
        List<DmsBaseDeviceDepreciation> list = dmsBaseDeviceDepreciationService.selectDmsBaseDeviceDepreciationList(dmsBaseDeviceDepreciation);
        return getDataTable(list);
    }

    /**
     * 导出设备折旧信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:export')" )
    //@Log(title = "设备折旧信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DmsBaseDeviceDepreciation dmsBaseDeviceDepreciation)
    {
        List<DmsBaseDeviceDepreciation> list = dmsBaseDeviceDepreciationService.selectDmsBaseDeviceDepreciationList(dmsBaseDeviceDepreciation);
        ExcelUtil<DmsBaseDeviceDepreciation> util = new ExcelUtil<DmsBaseDeviceDepreciation>(DmsBaseDeviceDepreciation.class);
        util.exportExcel(response, list, "设备折旧信息数据");
    }

    /**
     * 获取设备折旧信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:query')" )
    @GetMapping(value = "/{deviceDepreciationId}")
    public AjaxResult getInfo(@PathVariable("deviceDepreciationId") Long deviceDepreciationId)
    {
        return success(dmsBaseDeviceDepreciationService.selectDmsBaseDeviceDepreciationByDeviceDepreciationId(deviceDepreciationId));
    }

    /**
     * 新增设备折旧信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:add')" )
    //@Log(title = "设备折旧信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DmsBaseDeviceDepreciation dmsBaseDeviceDepreciation)
    {
        return toAjax(dmsBaseDeviceDepreciationService.insertDmsBaseDeviceDepreciation(dmsBaseDeviceDepreciation));
    }

    /**
     * 修改设备折旧信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:edit')" )
    //@Log(title = "设备折旧信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DmsBaseDeviceDepreciation dmsBaseDeviceDepreciation)
    {
        return toAjax(dmsBaseDeviceDepreciationService.updateDmsBaseDeviceDepreciation(dmsBaseDeviceDepreciation));
    }

    /**
     * 删除设备折旧信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:devicedepreciation:remove')" )
    //@Log(title = "设备折旧信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{deviceDepreciationIds}")
    public AjaxResult remove(@PathVariable Long[] deviceDepreciationIds)
    {
        return toAjax(dmsBaseDeviceDepreciationService.deleteDmsBaseDeviceDepreciationByDeviceDepreciationIds(deviceDepreciationIds));
    }
}
