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.AppUsersCashAccount;
import com.game.business.service.IAppUsersCashAccountService;
import com.game.common.utils.poi.ExcelUtil;
import com.game.common.core.page.TableDataInfo;

/**
 * 用户提现账号Controller
 * 
 * @author game
 * @date 2024-09-07
 */
@RestController
@RequestMapping("/business/account")
@Api(value = "AppUsersCashAccountController", description = "用户提现账号接口", tags = {"用户提现账号"})
public class AppUsersCashAccountController extends BaseController
{
    @Autowired
    private IAppUsersCashAccountService appUsersCashAccountService;

    /**
     * 查询用户提现账号列表
     */
    @PreAuthorize("@ss.hasPermi('business:account:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询用户提现账号列表", notes = "获取用户提现账号列表")
    public TableDataInfo<AppUsersCashAccount> list(AppUsersCashAccount appUsersCashAccount)
    {
        startPage();
        List<AppUsersCashAccount> list = appUsersCashAccountService.selectAppUsersCashAccountList(appUsersCashAccount);
        return getDataTable(list);
    }

    /**
     * 导出用户提现账号列表
     */
    @PreAuthorize("@ss.hasPermi('business:account:export')")
    @Log(title = "用户提现账号", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出用户提现账号列表", notes = "导出用户提现账号列表")
    public void export(HttpServletResponse response, AppUsersCashAccount appUsersCashAccount)
    {
        List<AppUsersCashAccount> list = appUsersCashAccountService.selectAppUsersCashAccountList(appUsersCashAccount);
        ExcelUtil<AppUsersCashAccount> util = new ExcelUtil<AppUsersCashAccount>(AppUsersCashAccount.class);
        util.exportExcel(response, list, "用户提现账号数据");
    }

    /**
     * 获取用户提现账号详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:account:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取用户提现账号详细信息", notes = "获取用户提现账号详细信息")
    public R<AppUsersCashAccount> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(appUsersCashAccountService.selectAppUsersCashAccountById(id));
    }

    /**
     * 新增用户提现账号
     */
    @PreAuthorize("@ss.hasPermi('business:account:add')")
    @Log(title = "用户提现账号", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增用户提现账号", notes = "新增用户提现账号")
    @PostMapping
    public R add(@RequestBody AppUsersCashAccount appUsersCashAccount)
    {
        return R.ok(appUsersCashAccountService.insertAppUsersCashAccount(appUsersCashAccount));
    }

    /**
     * 修改用户提现账号
     */
    @PreAuthorize("@ss.hasPermi('business:account:edit')")
    @Log(title = "用户提现账号", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改用户提现账号", notes = "修改用户提现账号")
    @PutMapping
    public R edit(@RequestBody AppUsersCashAccount appUsersCashAccount)
    {
        return R.ok(appUsersCashAccountService.updateAppUsersCashAccount(appUsersCashAccount));
    }

    /**
     * 删除用户提现账号
     */
    @PreAuthorize("@ss.hasPermi('business:account:remove')")
    @Log(title = "用户提现账号", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除用户提现账号", notes = "删除用户提现账号")
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.ok(appUsersCashAccountService.deleteAppUsersCashAccountByIds(ids));
    }
}
