package com.ruoyi.brewery.controller;

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.brewery.domain.WyBreweryShareLog;
import com.ruoyi.brewery.service.IWyBreweryShareLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 品牌方分享方案参与记录Controller
 * 
 * @author ruoyi
 * @date 2025-02-23
 */
@Api(tags = "品牌方分享方案参与记录管理")
@RestController
@RequestMapping("/brewery/breweryShareLog")
public class WyBreweryShareLogController extends BaseController
{
    @Autowired
    private IWyBreweryShareLogService wyBreweryShareLogService;

    /**
     * 查询品牌方分享方案参与记录列表
     */
    @ApiOperation(value = "查询品牌方分享方案参与记录列表", notes = "查询品牌方分享方案参与记录列表")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyBreweryShareLog wyBreweryShareLog)
    {
        startPage();
        List<WyBreweryShareLog> list = wyBreweryShareLogService.selectWyBreweryShareLogList(wyBreweryShareLog);
        return getDataTable(list);
    }

    /**
     * 导出品牌方分享方案参与记录列表
     */
    @ApiOperation(value = "导出品牌方分享方案参与记录列表", notes = "导出品牌方分享方案参与记录列表")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:export')")
    @Log(title = "品牌方分享方案参与记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WyBreweryShareLog wyBreweryShareLog)
    {
        List<WyBreweryShareLog> list = wyBreweryShareLogService.selectWyBreweryShareLogList(wyBreweryShareLog);
        ExcelUtil<WyBreweryShareLog> util = new ExcelUtil<WyBreweryShareLog>(WyBreweryShareLog.class);
        util.exportExcel(response, list, "品牌方分享方案参与记录数据");
    }

    /**
     * 获取品牌方分享方案参与记录详细信息
     */
    @ApiOperation(value = "获取品牌方分享方案参与记录详细信息", notes = "获取品牌方分享方案参与记录详细信息")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wyBreweryShareLogService.selectWyBreweryShareLogById(id));
    }

    /**
     * 新增品牌方分享方案参与记录
     */
    @ApiOperation(value = "新增品牌方分享方案参与记录", notes = "新增品牌方分享方案参与记录")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:add')")
    @Log(title = "品牌方分享方案参与记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyBreweryShareLog wyBreweryShareLog)
    {
        return toAjax(wyBreweryShareLogService.insertWyBreweryShareLog(wyBreweryShareLog));
    }

    /**
     * 修改品牌方分享方案参与记录
     */
    @ApiOperation(value = "修改品牌方分享方案参与记录", notes = "修改品牌方分享方案参与记录")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:edit')")
    @Log(title = "品牌方分享方案参与记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyBreweryShareLog wyBreweryShareLog)
    {
        return toAjax(wyBreweryShareLogService.updateWyBreweryShareLog(wyBreweryShareLog));
    }

    /**
     * 删除品牌方分享方案参与记录
     */
    @ApiOperation(value = "删除品牌方分享方案参与记录", notes = "删除品牌方分享方案参与记录")
    @PreAuthorize("@bss.hasPermi('brewery:breweryShareLog:remove')")
    @Log(title = "品牌方分享方案参与记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wyBreweryShareLogService.deleteWyBreweryShareLogByIds(ids));
    }
}
