package com.solution.web.controller.behaviour;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.solution.system.domain.Nodeconnection;
import com.solution.system.service.INodeconnectionService;
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.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;

/**
 * 节点连接Controller
 * 
 * @author ruoyi
 * @date 2026-02-05
 */
@RestController
@RequestMapping("/system/nodeconnection")
public class NodeconnectionController extends BaseController
{
    @Autowired
    private INodeconnectionService nodeconnectionService;

    /**
     * 查询节点连接列表
     */
    @PreAuthorize("@ss.hasPermi('system:nodeconnection:list')")
    @GetMapping("/list")
    public TableDataInfo list(Nodeconnection nodeconnection)
    {
        startPage();
        List<Nodeconnection> list = nodeconnectionService.selectNodeconnectionList(nodeconnection);
        return getDataTable(list);
    }

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

    /**
     * 获取节点连接详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:nodeconnection:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(nodeconnectionService.selectNodeconnectionById(id));
    }

    /**
     * 新增节点连接
     */
    @PreAuthorize("@ss.hasPermi('system:nodeconnection:add')")
    @Log(title = "节点连接", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Nodeconnection nodeconnection)
    {
        return toAjax(nodeconnectionService.insertNodeconnection(nodeconnection));
    }

    /**
     * 修改节点连接
     */
    @PreAuthorize("@ss.hasPermi('system:nodeconnection:edit')")
    @Log(title = "节点连接", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Nodeconnection nodeconnection)
    {
        return toAjax(nodeconnectionService.updateNodeconnection(nodeconnection));
    }

    /**
     * 删除节点连接
     */
    @PreAuthorize("@ss.hasPermi('system:nodeconnection:remove')")
    @Log(title = "节点连接", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(nodeconnectionService.deleteNodeconnectionByIds(ids));
    }
}
