package com.game.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.game.common.core.domain.R;
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.game.common.annotation.Log;
import com.game.common.core.controller.BaseController;
import com.game.common.core.domain.AjaxResult;
import com.game.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.game.business.domain.AppGameLotteryHistory;
import com.game.business.service.IAppGameLotteryHistoryService;
import com.game.common.utils.poi.ExcelUtil;
import com.game.common.core.page.TableDataInfo;

/**
 * 游戏开奖记录（备份）Controller
 * 
 * @author game
 * @date 2025-01-09
 */
@RestController
@RequestMapping("/business/appGameLotteryHistory")
@Api(value = "AppGameLotteryHistoryController", description = "游戏开奖记录（备份）接口", tags = {"游戏开奖记录（备份）"})
public class AppGameLotteryHistoryController extends BaseController
{
    @Autowired
    private IAppGameLotteryHistoryService appGameLotteryHistoryService;

    /**
     * 查询游戏开奖记录（备份）列表
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询游戏开奖记录（备份）列表", notes = "获取游戏开奖记录（备份）列表")
    public TableDataInfo<AppGameLotteryHistory> list(AppGameLotteryHistory appGameLotteryHistory)
    {
        startPage();
        List<AppGameLotteryHistory> list = appGameLotteryHistoryService.selectAppGameLotteryHistoryList(appGameLotteryHistory);
        return getDataTable(list);
    }

    /**
     * 导出游戏开奖记录（备份）列表
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:export')")
    @Log(title = "游戏开奖记录（备份）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出游戏开奖记录（备份）列表", notes = "导出游戏开奖记录（备份）列表")
    public void export(HttpServletResponse response, AppGameLotteryHistory appGameLotteryHistory)
    {
        List<AppGameLotteryHistory> list = appGameLotteryHistoryService.selectAppGameLotteryHistoryList(appGameLotteryHistory);
        ExcelUtil<AppGameLotteryHistory> util = new ExcelUtil<AppGameLotteryHistory>(AppGameLotteryHistory.class);
        util.exportExcel(response, list, "游戏开奖记录（备份）数据");
    }

    /**
     * 获取游戏开奖记录（备份）详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取游戏开奖记录（备份）详细信息", notes = "获取游戏开奖记录（备份）详细信息")
    public R<AppGameLotteryHistory> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(appGameLotteryHistoryService.selectAppGameLotteryHistoryById(id));
    }

    /**
     * 新增游戏开奖记录（备份）
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:add')")
    @Log(title = "游戏开奖记录（备份）", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增游戏开奖记录（备份）", notes = "新增游戏开奖记录（备份）")
    @PostMapping
    public R add(@RequestBody AppGameLotteryHistory appGameLotteryHistory)
    {
        return R.ok(appGameLotteryHistoryService.insertAppGameLotteryHistory(appGameLotteryHistory));
    }

    /**
     * 修改游戏开奖记录（备份）
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:edit')")
    @Log(title = "游戏开奖记录（备份）", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改游戏开奖记录（备份）", notes = "修改游戏开奖记录（备份）")
    @PutMapping
    public R edit(@RequestBody AppGameLotteryHistory appGameLotteryHistory)
    {
        return R.ok(appGameLotteryHistoryService.updateAppGameLotteryHistory(appGameLotteryHistory));
    }

    /**
     * 删除游戏开奖记录（备份）
     */
    @PreAuthorize("@ss.hasPermi('business:appGameLotteryHistory:remove')")
    @Log(title = "游戏开奖记录（备份）", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除游戏开奖记录（备份）", notes = "删除游戏开奖记录（备份）")
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.ok(appGameLotteryHistoryService.deleteAppGameLotteryHistoryByIds(ids));
    }
}
