package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.WyPlatformActivityBeer;
import com.ruoyi.system.service.IWyPlatformActivityBeerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 平台活动酒款Controller
 * 
 * @author ruoyi
 * @date 2025-01-06
 */
//@RestController
//@RequestMapping("/system/PlatformActivityBeer")
public class WyPlatformActivityBeerController extends BaseController
{
    @Autowired
    private IWyPlatformActivityBeerService wyPlatformActivityBeerService;

    /**
     * 查询平台活动酒款列表
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyPlatformActivityBeer wyPlatformActivityBeer)
    {
        startPage();
        List<WyPlatformActivityBeer> list = wyPlatformActivityBeerService.selectWyPlatformActivityBeerList(wyPlatformActivityBeer);
        return getDataTable(list);
    }

    /**
     * 导出平台活动酒款列表
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:export')")
    @Log(title = "平台活动酒款", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WyPlatformActivityBeer wyPlatformActivityBeer)
    {
        List<WyPlatformActivityBeer> list = wyPlatformActivityBeerService.selectWyPlatformActivityBeerList(wyPlatformActivityBeer);
        ExcelUtil<WyPlatformActivityBeer> util = new ExcelUtil<WyPlatformActivityBeer>(WyPlatformActivityBeer.class);
        util.exportExcel(response, list, "平台活动酒款数据");
    }

    /**
     * 获取平台活动酒款详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:query')")
    @GetMapping(value = "/{activityId}")
    public AjaxResult getInfo(@PathVariable("activityId") Long activityId)
    {
        return success(wyPlatformActivityBeerService.selectWyPlatformActivityBeerByActivityId(activityId));
    }

    /**
     * 新增平台活动酒款
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:add')")
    @Log(title = "平台活动酒款", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyPlatformActivityBeer wyPlatformActivityBeer)
    {
        return toAjax(wyPlatformActivityBeerService.insertWyPlatformActivityBeer(wyPlatformActivityBeer));
    }

    /**
     * 修改平台活动酒款
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:edit')")
    @Log(title = "平台活动酒款", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyPlatformActivityBeer wyPlatformActivityBeer)
    {
        return toAjax(wyPlatformActivityBeerService.updateWyPlatformActivityBeer(wyPlatformActivityBeer));
    }

    /**
     * 删除平台活动酒款
     */
    @PreAuthorize("@ss.hasPermi('system:PlatformActivityBeer:remove')")
    @Log(title = "平台活动酒款", businessType = BusinessType.DELETE)
	@DeleteMapping("/{activityIds}")
    public AjaxResult remove(@PathVariable Long[] activityIds)
    {
        return toAjax(wyPlatformActivityBeerService.deleteWyPlatformActivityBeerByActivityIds(activityIds));
    }
}
