package com.fastbee.data.controller.deviceManufacturers;

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

import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.deviceData.domain.DeviceManufacturers;
import com.fastbee.deviceData.service.IDeviceManufacturersService;
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.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.core.page.TableDataInfo;

/**
 * 设备厂家信息Controller
 *
 * @author kerwincui
 * @date 2024-11-13
 */
@RestController
@RequestMapping("/renke/manufacturers")
@Api(tags = "设备厂家信息")
public class DeviceManufacturersController extends BaseController
{
    @Autowired
    private IDeviceManufacturersService deviceManufacturersService;

/**
 * 查询设备厂家信息列表
 */
@PreAuthorize("@ss.hasPermi('renke:manufacturers:list')")
@GetMapping("/list")
@ApiOperation("查询设备厂家信息列表")
    public TableDataInfo list(DeviceManufacturers deviceManufacturers)
    {
        startPage();
        List<DeviceManufacturers> list = deviceManufacturersService.selectDeviceManufacturersList(deviceManufacturers);
        return getDataTable(list);
    }

    /**
     * 导出设备厂家信息列表
     */
    @ApiOperation("导出设备厂家信息列表")
    @PreAuthorize("@ss.hasPermi('renke:manufacturers:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, DeviceManufacturers deviceManufacturers)
    {
        List<DeviceManufacturers> list = deviceManufacturersService.selectDeviceManufacturersList(deviceManufacturers);
        ExcelUtil<DeviceManufacturers> util = new ExcelUtil<DeviceManufacturers>(DeviceManufacturers.class);
        util.exportExcel(response, list, "设备厂家信息数据");
    }

    /**
     * 获取设备厂家信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('renke:manufacturers:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取设备厂家信息详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(deviceManufacturersService.selectDeviceManufacturersById(id));
    }

    /**
     * 新增设备厂家信息
     */
    @PreAuthorize("@ss.hasPermi('renke:manufacturers:add')")
    @PostMapping
    @ApiOperation("新增设备厂家信息")
    public AjaxResult add(@RequestBody DeviceManufacturers deviceManufacturers)
    {
        return toAjax(deviceManufacturersService.insertDeviceManufacturers(deviceManufacturers));
    }

    /**
     * 修改设备厂家信息
     */
    @PreAuthorize("@ss.hasPermi('renke:manufacturers:edit')")
    @PutMapping
    @ApiOperation("修改设备厂家信息")
    public AjaxResult edit(@RequestBody DeviceManufacturers deviceManufacturers)
    {
        return toAjax(deviceManufacturersService.updateDeviceManufacturers(deviceManufacturers));
    }

    /**
     * 删除设备厂家信息
     */
    @PreAuthorize("@ss.hasPermi('renke:manufacturers:remove')")
    @DeleteMapping("/{ids}")
    @ApiOperation("删除设备厂家信息")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(deviceManufacturersService.deleteDeviceManufacturersByIds(ids));
    }
}
