package com.fastbee.data.controller.aaScreenAgricultural.deviceBaseInfo;

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

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.deviceInfo.domain.DeviceInformationMonitor;
import com.fastbee.deviceInfo.service.IDeviceInformationMonitorService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;

/**
 * 监控站设备基础信息Controller
 *
 * @author kerwincui
 * @date 2024-11-27
 */
@RestController
@RequestMapping("/deviceInfo/monitor")
@Api(tags = "监控站设备基础信息")
public class DeviceInformationMonitorController extends BaseController
{
    @Autowired
    private IDeviceInformationMonitorService deviceInformationMonitorService;

/**
 * 查询监控站设备基础信息列表
 */
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:list')")
@GetMapping("/list")
@ApiOperation("查询监控站设备基础信息列表")
    public TableDataInfo list(DeviceInformationMonitor deviceInformationMonitor)
    {
        startPage();
        List<DeviceInformationMonitor> list = deviceInformationMonitorService.selectDeviceInformationMonitorList(deviceInformationMonitor);
        return getDataTable(list);
    }

    /**
     * 导出监控站设备基础信息列表
     */
    @ApiOperation("导出监控站设备基础信息列表")
    @PreAuthorize("@ss.hasPermi('deviceInfo:monitor:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, DeviceInformationMonitor deviceInformationMonitor)
    {
        List<DeviceInformationMonitor> list = deviceInformationMonitorService.selectDeviceInformationMonitorList(deviceInformationMonitor);
        ExcelUtil<DeviceInformationMonitor> util = new ExcelUtil<DeviceInformationMonitor>(DeviceInformationMonitor.class);
        util.exportExcel(response, list, "监控站设备基础信息数据");
    }

    /**
     * 获取监控站设备基础信息详细信息
     */
    @GetMapping(value = "/deviceEncoding")
    @ApiOperation("获取监控站设备基础信息详细信息")
    public AjaxResult getInfo(String deviceEncoding)
    {
        return success(deviceInformationMonitorService.selectDeviceInformationMonitorById(deviceEncoding));
    }

    /**
     * 新增监控站设备基础信息
     */
    @PreAuthorize("@ss.hasPermi('deviceInfo:monitor:add')")
    @PostMapping
    @ApiOperation("新增监控站设备基础信息")
    public AjaxResult add(@RequestBody DeviceInformationMonitor deviceInformationMonitor)
    {
        return toAjax(deviceInformationMonitorService.insertDeviceInformationMonitor(deviceInformationMonitor));
    }

    /**
     * 修改监控站设备基础信息
     */
    @PreAuthorize("@ss.hasPermi('deviceInfo:monitor:edit')")
    @PutMapping
    @ApiOperation("修改监控站设备基础信息")
    public AjaxResult edit(@RequestBody DeviceInformationMonitor deviceInformationMonitor)
    {
        return toAjax(deviceInformationMonitorService.updateDeviceInformationMonitor(deviceInformationMonitor));
    }

    /**
     * 删除监控站设备基础信息
     */
    @PreAuthorize("@ss.hasPermi('deviceInfo:monitor:remove')")
    @DeleteMapping("/{ids}")
    @ApiOperation("删除监控站设备基础信息")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(deviceInformationMonitorService.deleteDeviceInformationMonitorByIds(ids));
    }
}
