package com.ruoyi.web.controller.system;

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

/**
 * 专题页Controller
 * 
 * @author ruoyi
 * @date 2025-01-06
 */
@Api(tags = "平台专题页信息")
@RestController
@RequestMapping("/system/PlatFormFeaturePage")
public class WyPlatformFeaturePageController extends BaseController
{
    @Autowired
    private IWyPlatformFeaturePageService wyPlatformFeaturePageService;

    /**
     * 查询专题页列表
     */
    @ApiOperation(value = "查询专题页列表", notes = "查询专题页列表")
    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyPlatformFeaturePage wyPlatformFeaturePage)
    {
        startPage();
        List<WyPlatformFeaturePage> list = wyPlatformFeaturePageService.selectWyPlatformFeaturePageList(wyPlatformFeaturePage);
        return getDataTable(list);
    }


    /**
     * 导出专题页列表
     */
//    @ApiOperation(value = "导出专题页列表", notes = "导出专题页列表")
//    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:export')")
//    @Log(title = "专题页", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, WyPlatformFeaturePage wyPlatformFeaturePage)
//    {
//        List<WyPlatformFeaturePage> list = wyPlatformFeaturePageService.selectWyPlatformFeaturePageList(wyPlatformFeaturePage);
//        ExcelUtil<WyPlatformFeaturePage> util = new ExcelUtil<WyPlatformFeaturePage>(WyPlatformFeaturePage.class);
//        util.exportExcel(response, list, "专题页数据");
//    }

    /**
     * 获取专题页详细信息
     */
    @ApiOperation(value = "获取专题页详细信息", notes = "获取专题页详细信息")
    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wyPlatformFeaturePageService.selectWyPlatformFeaturePageById(id));
    }

    /**
     * 新增专题页
     */
    @ApiOperation(value = "新增专题页", notes = "新增专题页")
    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:add')")
    @Log(title = "专题页", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyPlatformFeaturePage wyPlatformFeaturePage)
    {
        return toAjax(wyPlatformFeaturePageService.insertWyPlatformFeaturePage(wyPlatformFeaturePage));
    }

    /**
     * 修改专题页
     */
    @ApiOperation(value = "修改专题页", notes = "修改专题页")
    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:edit')")
    @Log(title = "专题页", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyPlatformFeaturePage wyPlatformFeaturePage)
    {
        return toAjax(wyPlatformFeaturePageService.updateWyPlatformFeaturePage(wyPlatformFeaturePage));
    }

    /**
     * 删除专题页
     */
    @ApiOperation(value = "删除专题页", notes = "删除专题页")
    @PreAuthorize("@ss.hasPermi('system:PlatFormFeaturePage:remove')")
    @Log(title = "专题页", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wyPlatformFeaturePageService.deleteWyPlatformFeaturePageByIds(ids));
    }
}
