package com.agri.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.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.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.system.domain.SysRollerAir;
import com.agri.system.service.ISysRollerAirService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;

/**
 * 自动化卷膜风口大小设置Controller
 * 
 * @author lld
 * @date 2026-03-04
 */
@RestController
@RequestMapping("/assets/air")
public class SysRollerAirController extends BaseController
{
    @Autowired
    private ISysRollerAirService sysRollerAirService;

    /**
     * 查询自动化卷膜风口大小设置列表
     */
    @PreAuthorize("@ss.hasPermi('assets:air:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysRollerAir sysRollerAir)
    {
        startPage();
        List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
        return getDataTable(list);
    }

    /**
     * 导出自动化卷膜风口大小设置列表
     */
    @PreAuthorize("@ss.hasPermi('assets:air:export')")
    @Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysRollerAir sysRollerAir)
    {
        List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
        ExcelUtil<SysRollerAir> util = new ExcelUtil<SysRollerAir>(SysRollerAir.class);
        util.exportExcel(response, list, "自动化卷膜风口大小设置数据");
    }

    /**
     * 获取自动化卷膜风口大小设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('assets:air:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysRollerAirService.selectSysRollerAirById(id));
    }

    /**
     * 新增自动化卷膜风口大小设置
     */
    @PreAuthorize("@ss.hasPermi('assets:air:add')")
    @Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysRollerAir sysRollerAir)
    {
        return toAjax(sysRollerAirService.insertSysRollerAir(sysRollerAir));
    }

    /**
     * 修改自动化卷膜风口大小设置
     */
    @PreAuthorize("@ss.hasPermi('assets:air:edit')")
    @Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysRollerAir sysRollerAir)
    {
        return toAjax(sysRollerAirService.updateSysRollerAir(sysRollerAir));
    }

    /**
     * 删除自动化卷膜风口大小设置
     */
    @PreAuthorize("@ss.hasPermi('assets:air:remove')")
    @Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysRollerAirService.deleteSysRollerAirByIds(ids));
    }
}
