package com.ruixuan.isc.controller;


import com.ruixuan.common.core.controller.BaseController;
import com.ruixuan.common.core.domain.AjaxResult;
import com.ruixuan.common.core.page.TableDataInfo;
import com.ruixuan.common.utils.Result;
import com.ruixuan.isc.entity.KuaishouLabel;
import com.ruixuan.isc.service.IKuaishouLabelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 快手标签Controller
 *
 * @author ruoyi
 * @date 2023-03-28
 */
@Api(tags = "快手标签")
@RestController
@RequestMapping("/kuaishou/label")
public class KuaishouLabelController extends BaseController {
    @Autowired
    private IKuaishouLabelService kuaishouLabelService;

    /**
     * 查询快手标签列表
     */
    @ApiOperation(value = "查询快手标签列表")
    @GetMapping("/list")
    public TableDataInfo list(KuaishouLabel kuaishouLabel) {
        startPage();
        List<KuaishouLabel> list = kuaishouLabelService.selectKuaishouLabelList(kuaishouLabel);
        return getDataTable(list);
    }

    /**
     * 新增快手标签
     */
    @ApiOperation(value = "新增快手标签")
    @PostMapping(value = "/add")
    public Result add(@RequestBody KuaishouLabel kuaishouLabel) {
        return kuaishouLabelService.insertKuaishouLabel(kuaishouLabel);
    }

    /**
     * 修改快手标签
     */
    @PostMapping(value = "/edit")
    public AjaxResult edit(@RequestBody KuaishouLabel kuaishouLabel) {
        return toAjax(kuaishouLabelService.updateKuaishouLabel(kuaishouLabel));
    }

    /**
     * 删除快手标签
     */
    @ApiOperation(value = "删除快手标签")
    @GetMapping(value = "/deleteById")
    public AjaxResult remove(Long id) {
        return toAjax(kuaishouLabelService.deleteKuaishouLabelById(id));
    }
}