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

/**
 * 直播待分成表Controller
 * 
 * @author game
 * @date 2024-06-30
 */
@RestController
@RequestMapping("/business/divided")
@Api(value = "AppUserLiveDividedController", description = "直播待分成表接口", tags = {"直播待分成表"})
public class AppUserLiveDividedController extends BaseController
{
    @Autowired
    private IAppUserLiveDividedService appUserLiveDividedService;

    /**
     * 查询直播待分成表列表
     */
    @PreAuthorize("@ss.hasPermi('business:divided:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询直播待分成表列表", notes = "获取直播待分成表列表")
    public TableDataInfo<AppUserLiveDivided> list(AppUserLiveDivided appUserLiveDivided)
    {
        startPage();
        List<AppUserLiveDivided> list = appUserLiveDividedService.selectAppUserLiveDividedList(appUserLiveDivided);
        return getDataTable(list);
    }

    /**
     * 导出直播待分成表列表
     */
    @PreAuthorize("@ss.hasPermi('business:divided:export')")
    @Log(title = "直播待分成表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出直播待分成表列表", notes = "导出直播待分成表列表")
    public void export(HttpServletResponse response, AppUserLiveDivided appUserLiveDivided)
    {
        List<AppUserLiveDivided> list = appUserLiveDividedService.selectAppUserLiveDividedList(appUserLiveDivided);
        ExcelUtil<AppUserLiveDivided> util = new ExcelUtil<AppUserLiveDivided>(AppUserLiveDivided.class);
        util.exportExcel(response, list, "直播待分成表数据");
    }

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

    /**
     * 新增直播待分成表
     */
    @PreAuthorize("@ss.hasPermi('business:divided:add')")
    @Log(title = "直播待分成表", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增直播待分成表", notes = "新增直播待分成表")
    @PostMapping
    public R add(@RequestBody AppUserLiveDivided appUserLiveDivided)
    {
        return R.ok(appUserLiveDividedService.insertAppUserLiveDivided(appUserLiveDivided));
    }

    /**
     * 修改直播待分成表
     */
    @PreAuthorize("@ss.hasPermi('business:divided:edit')")
    @Log(title = "直播待分成表", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改直播待分成表", notes = "修改直播待分成表")
    @PutMapping
    public R edit(@RequestBody AppUserLiveDivided appUserLiveDivided)
    {
        return R.ok(appUserLiveDividedService.updateAppUserLiveDivided(appUserLiveDivided));
    }

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