package com.ruixuan.bytedance.controller;

import com.ruixuan.bytedance.entity.BytedanceColonelActivity;
import com.ruixuan.bytedance.service.IBytedanceColonelActivityService;
import com.ruixuan.common.core.controller.BaseController;
import com.ruixuan.common.core.domain.AjaxResult;
import com.ruixuan.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 团长活动 信息Controller
 *
 * @date 2023-08-11
 */
@Api(tags = "头条团长活动")
@RestController
@RequestMapping("/bytedance/activity")
public class BytedanceColonelActivityController extends BaseController {
    @Autowired
    private IBytedanceColonelActivityService bytedanceColonelActivityService;

    /**
     * 查询团长活动 信息列表
     */
    @ApiOperation(value = "查询团长活动 信息列表")
    @GetMapping("/list")
    public TableDataInfo list(BytedanceColonelActivity bytedanceColonelActivity) {
        startPage();
        List<BytedanceColonelActivity> list = bytedanceColonelActivityService.selectBytedanceColonelActivityList(bytedanceColonelActivity);
        return getDataTable(list);
    }

    /**
     * 获取团长活动 信息详细信息
     */
    @ApiOperation(value = "获取团长活动 信息详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(bytedanceColonelActivityService.selectBytedanceColonelActivityById(id));
    }

    /**
     * 修改团长活动 信息
     */
    @ApiOperation(value = "修改团长活动 信息")
    @PutMapping
    public AjaxResult edit(@RequestBody BytedanceColonelActivity bytedanceColonelActivity) {
        return toAjax(bytedanceColonelActivityService.updateBytedanceColonelActivity(bytedanceColonelActivity));
    }

    /**
     * 删除团长活动 信息
     */
    @ApiOperation(value = "修改团长活动 信息")
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(bytedanceColonelActivityService.deleteBytedanceColonelActivityByIds(ids));
    }
}