package com.ruoyi.web.controller.bar;

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.bar.domain.WyBeerQrcodeScanLog;
import com.ruoyi.bar.service.IWyBeerQrcodeScanLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 酒品二维码扫码记录Controller
 * 
 * @author kxl
 * @date 2025-01-27
 */
@RestController
@RequestMapping("/system/QrcodeScanLog")
public class WyBeerQrcodeScanLogController extends BaseController
{
    @Autowired
    private IWyBeerQrcodeScanLogService wyBeerQrcodeScanLogService;

    /**
     * 查询酒品二维码扫码记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyBeerQrcodeScanLog wyBeerQrcodeScanLog)
    {
        startPage();
        List<WyBeerQrcodeScanLog> list = wyBeerQrcodeScanLogService.selectWyBeerQrcodeScanLogList(wyBeerQrcodeScanLog);
        return getDataTable(list);
    }

    /**
     * 导出酒品二维码扫码记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:export')")
    @Log(title = "酒品二维码扫码记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WyBeerQrcodeScanLog wyBeerQrcodeScanLog)
    {
        List<WyBeerQrcodeScanLog> list = wyBeerQrcodeScanLogService.selectWyBeerQrcodeScanLogList(wyBeerQrcodeScanLog);
        ExcelUtil<WyBeerQrcodeScanLog> util = new ExcelUtil<WyBeerQrcodeScanLog>(WyBeerQrcodeScanLog.class);
        util.exportExcel(response, list, "酒品二维码扫码记录数据");
    }

    /**
     * 获取酒品二维码扫码记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wyBeerQrcodeScanLogService.selectWyBeerQrcodeScanLogById(id));
    }

    /**
     * 新增酒品二维码扫码记录
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:add')")
    @Log(title = "酒品二维码扫码记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyBeerQrcodeScanLog wyBeerQrcodeScanLog)
    {
        return toAjax(wyBeerQrcodeScanLogService.insertWyBeerQrcodeScanLog(wyBeerQrcodeScanLog));
    }

    /**
     * 修改酒品二维码扫码记录
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:edit')")
    @Log(title = "酒品二维码扫码记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyBeerQrcodeScanLog wyBeerQrcodeScanLog)
    {
        return toAjax(wyBeerQrcodeScanLogService.updateWyBeerQrcodeScanLog(wyBeerQrcodeScanLog));
    }

    /**
     * 删除酒品二维码扫码记录
     */
    @PreAuthorize("@ss.hasPermi('system:QrcodeScanLog:remove')")
    @Log(title = "酒品二维码扫码记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wyBeerQrcodeScanLogService.deleteWyBeerQrcodeScanLogByIds(ids));
    }
}
