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

/**
 * 品牌方角色和菜单关联Controller
 * 
 * @author ruoyi
 * @date 2024-12-22
 */
@Api(tags="品牌方角色和菜单关联管理")
@RestController
@RequestMapping("/brewery/rolemenu")
public class BreweryRoleMenuController extends BaseController
{
    @Autowired
    private IWyBreweryRoleMenuService wyBreweryRoleMenuService;

    /**
     * 查询品牌方角色和菜单关联列表
     */
    @ApiOperation("查询品牌方角色和菜单关联列表")
    @PreAuthorize("@bss.hasPermi('brewery:menu:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyBreweryRoleMenu wyBreweryRoleMenu)
    {
        startPage();
        List<WyBreweryRoleMenu> list = wyBreweryRoleMenuService.selectWyBreweryRoleMenuList(wyBreweryRoleMenu);
        return getDataTable(list);
    }

    /**
     * 导出品牌方角色和菜单关联列表
     */
//    @ApiOperation("导出品牌方角色和菜单关联列表")
//    @PreAuthorize("@bss.hasPermi('brewery:menu:export')")
//    @Log(title = "品牌方角色和菜单关联", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, WyBreweryRoleMenu wyBreweryRoleMenu)
//    {
//        List<WyBreweryRoleMenu> list = wyBreweryRoleMenuService.selectWyBreweryRoleMenuList(wyBreweryRoleMenu);
//        ExcelUtil<WyBreweryRoleMenu> util = new ExcelUtil<WyBreweryRoleMenu>(WyBreweryRoleMenu.class);
//        util.exportExcel(response, list, "品牌方角色和菜单关联数据");
//    }

    /**
     * 获取品牌方角色和菜单关联详细信息
     */
    @ApiOperation("获取品牌方角色和菜单关联详细信息")
    @PreAuthorize("@bss.hasPermi('brewery:menu:query')")
    @GetMapping(value = "/{roleId}")
    public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
    {
        return success(wyBreweryRoleMenuService.selectWyBreweryRoleMenuByRoleId(roleId));
    }

    /**
     * 新增品牌方角色和菜单关联
     */
//    @ApiOperation("新增品牌方角色和菜单关联")
//    @PreAuthorize("@bss.hasPermi('brewery:menu:add')")
//    @Log(title = "品牌方角色和菜单关联", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody WyBreweryRoleMenu wyBreweryRoleMenu)
//    {
//        return toAjax(wyBreweryRoleMenuService.insertWyBreweryRoleMenu(wyBreweryRoleMenu));
//    }

    /**
     * 修改品牌方角色和菜单关联
     */
//    @ApiOperation("修改品牌方角色和菜单关联")
//    @PreAuthorize("@bss.hasPermi('brewery:menu:edit')")
//    @Log(title = "品牌方角色和菜单关联", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody WyBreweryRoleMenu wyBreweryRoleMenu)
//    {
//        return toAjax(wyBreweryRoleMenuService.updateWyBreweryRoleMenu(wyBreweryRoleMenu));
//    }

    /**
     * 删除品牌方角色和菜单关联
     */
//    @ApiOperation("删除品牌方角色和菜单关联")
//    @PreAuthorize("@bss.hasPermi('brewery:menu:remove')")
//    @Log(title = "品牌方角色和菜单关联", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{roleIds}")
//    public AjaxResult remove(@PathVariable Long[] roleIds)
//    {
//        return toAjax(wyBreweryRoleMenuService.deleteWyBreweryRoleMenuByRoleIds(roleIds));
//    }
}
