package com.fs.qw.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.qw.domain.QwIpadServer;
import com.fs.qw.service.IQwIpadServerService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * ipad服务器Controller
 *
 * @author fs
 * @date 2025-07-23
 */
@RestController
@RequestMapping("/qw/qwIpadServer")
public class QwIpadServerController extends BaseController
{
    @Autowired
    private IQwIpadServerService qwIpadServerService;

    /**
     * 查询ipad服务器列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwIpadServer qwIpadServer)
    {
        startPage();
        List<QwIpadServer> list = qwIpadServerService.selectQwIpadServerList(qwIpadServer);
        return getDataTable(list);
    }

    /**
     * 导出ipad服务器列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:export')")
    @Log(title = "ipad服务器", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwIpadServer qwIpadServer)
    {
        List<QwIpadServer> list = qwIpadServerService.selectQwIpadServerList(qwIpadServer);
        ExcelUtil<QwIpadServer> util = new ExcelUtil<QwIpadServer>(QwIpadServer.class);
        return util.exportExcel(list, "ipad服务器数据");
    }

    /**
     * 获取ipad服务器详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwIpadServerService.selectQwIpadServerById(id));
    }

    /**
     * 新增ipad服务器
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:add')")
    @Log(title = "ipad服务器", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwIpadServer qwIpadServer)
    {
        return toAjax(qwIpadServerService.insertQwIpadServer(qwIpadServer));
    }

    /**
     * 修改ipad服务器
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:edit')")
    @Log(title = "ipad服务器", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwIpadServer qwIpadServer)
    {
        return toAjax(qwIpadServerService.updateQwIpadServer(qwIpadServer));
    }

    /**
     * 删除ipad服务器
     */
    @PreAuthorize("@ss.hasPermi('qw:qwIpadServer:remove')")
    @Log(title = "ipad服务器", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwIpadServerService.deleteQwIpadServerByIds(ids));
    }
}
