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

/**
 * 直播分成记录表Controller
 * 
 * @author game
 * @date 2024-06-30
 */
@RestController
@RequestMapping("/business/record")
@Api(value = "AppUserLiveDividedRecordController", description = "直播分成记录表接口", tags = {"直播分成记录表"})
public class AppUserLiveDividedRecordController extends BaseController
{
    @Autowired
    private IAppUserLiveDividedRecordService appUserLiveDividedRecordService;

    /**
     * 查询直播分成记录表列表
     */
    @PreAuthorize("@ss.hasPermi('business:record:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询直播分成记录表列表", notes = "获取直播分成记录表列表")
    public TableDataInfo<AppUserLiveDividedRecord> list(AppUserLiveDividedRecord appUserLiveDividedRecord)
    {
        startPage();
        List<AppUserLiveDividedRecord> list = appUserLiveDividedRecordService.selectAppUserLiveDividedRecordList(appUserLiveDividedRecord);
        return getDataTable(list);
    }

    /**
     * 导出直播分成记录表列表
     */
    @PreAuthorize("@ss.hasPermi('business:record:export')")
    @Log(title = "直播分成记录表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出直播分成记录表列表", notes = "导出直播分成记录表列表")
    public void export(HttpServletResponse response, AppUserLiveDividedRecord appUserLiveDividedRecord)
    {
        List<AppUserLiveDividedRecord> list = appUserLiveDividedRecordService.selectAppUserLiveDividedRecordList(appUserLiveDividedRecord);
        ExcelUtil<AppUserLiveDividedRecord> util = new ExcelUtil<AppUserLiveDividedRecord>(AppUserLiveDividedRecord.class);
        util.exportExcel(response, list, "直播分成记录表数据");
    }

    /**
     * 获取直播分成记录表详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:record:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取直播分成记录表详细信息", notes = "获取直播分成记录表详细信息")
    public R<AppUserLiveDividedRecord> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(appUserLiveDividedRecordService.selectAppUserLiveDividedRecordById(id));
    }

    /**
     * 新增直播分成记录表
     */
    @PreAuthorize("@ss.hasPermi('business:record:add')")
    @Log(title = "直播分成记录表", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增直播分成记录表", notes = "新增直播分成记录表")
    @PostMapping
    public R add(@RequestBody AppUserLiveDividedRecord appUserLiveDividedRecord)
    {
        return R.ok(appUserLiveDividedRecordService.insertAppUserLiveDividedRecord(appUserLiveDividedRecord));
    }

    /**
     * 修改直播分成记录表
     */
    @PreAuthorize("@ss.hasPermi('business:record:edit')")
    @Log(title = "直播分成记录表", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改直播分成记录表", notes = "修改直播分成记录表")
    @PutMapping
    public R edit(@RequestBody AppUserLiveDividedRecord appUserLiveDividedRecord)
    {
        return R.ok(appUserLiveDividedRecordService.updateAppUserLiveDividedRecord(appUserLiveDividedRecord));
    }

    /**
     * 删除直播分成记录表
     */
    @PreAuthorize("@ss.hasPermi('business:record:remove')")
    @Log(title = "直播分成记录表", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除直播分成记录表", notes = "删除直播分成记录表")
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.ok(appUserLiveDividedRecordService.deleteAppUserLiveDividedRecordByIds(ids));
    }
}
