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.SysRollerParam;
import com.agri.system.service.ISysRollerParamService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;

/**
 * 卷膜参数配置Controller
 * 
 * @author lld
 * @date 2026-02-27
 */
@RestController
@RequestMapping("/control/rollerParam")
public class SysRollerParamController extends BaseController
{
    @Autowired
    private ISysRollerParamService sysRollerParamService;

    /**
     * 查询卷膜参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysRollerParam sysRollerParam)
    {
        startPage();
        List<SysRollerParam> list = sysRollerParamService.selectSysRollerParamList(sysRollerParam);
        return getDataTable(list);
    }

    /**
     * 导出卷膜参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:export')")
    @Log(title = "卷膜参数配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysRollerParam sysRollerParam)
    {
        List<SysRollerParam> list = sysRollerParamService.selectSysRollerParamList(sysRollerParam);
        ExcelUtil<SysRollerParam> util = new ExcelUtil<SysRollerParam>(SysRollerParam.class);
        util.exportExcel(response, list, "卷膜参数配置数据");
    }

    /**
     * 获取卷膜参数配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(sysRollerParamService.selectSysRollerParamById(id));
    }

    /**
     * 新增卷膜参数配置
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:add')")
    @Log(title = "卷膜参数配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysRollerParam sysRollerParam)
    {
        return toAjax(sysRollerParamService.insertSysRollerParam(sysRollerParam));
    }

    /**
     * 修改卷膜参数配置
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:edit')")
    @Log(title = "卷膜参数配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysRollerParam sysRollerParam)
    {
        return toAjax(sysRollerParamService.updateSysRollerParam(sysRollerParam));
    }

    /**
     * 删除卷膜参数配置
     */
    @PreAuthorize("@ss.hasPermi('control:rollerParam:remove')")
    @Log(title = "卷膜参数配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(sysRollerParamService.deleteSysRollerParamByIds(ids));
    }
}
