package com.solution.web.controller.behaviour;

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

/**
 * 节点参数Controller
 * 
 * @author ruoyi
 * @date 2026-02-05
 */
@RestController
@RequestMapping("/system/nodeparameter")
public class NodeparameterController extends BaseController
{
    @Autowired
    private INodeparameterService nodeparameterService;

    /**
     * 查询节点参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:list')")
    @GetMapping("/list")
    public TableDataInfo list(Nodeparameter nodeparameter)
    {
        startPage();
        List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
        return getDataTable(list);
    }

    /**
     * 导出节点参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:export')")
    @Log(title = "节点参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Nodeparameter nodeparameter)
    {
        List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
        ExcelUtil<Nodeparameter> util = new ExcelUtil<Nodeparameter>(Nodeparameter.class);
        util.exportExcel(response, list, "节点参数数据");
    }

    /**
     * 获取节点参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(nodeparameterService.selectNodeparameterById(id));
    }

    /**
     * 新增节点参数
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:add')")
    @Log(title = "节点参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Nodeparameter nodeparameter)
    {
        return toAjax(nodeparameterService.insertNodeparameter(nodeparameter));
    }

    /**
     * 修改节点参数
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:edit')")
    @Log(title = "节点参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Nodeparameter nodeparameter)
    {
        return toAjax(nodeparameterService.updateNodeparameter(nodeparameter));
    }

    /**
     * 删除节点参数
     */
    @PreAuthorize("@ss.hasPermi('system:nodeparameter:remove')")
    @Log(title = "节点参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(nodeparameterService.deleteNodeparameterByIds(ids));
    }
}
