package com.fs.course.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.course.domain.FsUserVideoCommentLike;
import com.fs.course.service.IFsUserVideoCommentLikeService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 课堂评论点赞Controller
 * 
 * @author fs
 * @date 2024-05-15
 */
@RestController
@RequestMapping("/course/userVideoCommentLike")
public class FsUserVideoCommentLikeController extends BaseController
{
    @Autowired
    private IFsUserVideoCommentLikeService fsUserVideoCommentLikeService;

    /**
     * 查询课堂评论点赞列表
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsUserVideoCommentLike fsUserVideoCommentLike)
    {
        startPage();
        List<FsUserVideoCommentLike> list = fsUserVideoCommentLikeService.selectFsUserVideoCommentLikeList(fsUserVideoCommentLike);
        return getDataTable(list);
    }

    /**
     * 导出课堂评论点赞列表
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:export')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsUserVideoCommentLike fsUserVideoCommentLike)
    {
        List<FsUserVideoCommentLike> list = fsUserVideoCommentLikeService.selectFsUserVideoCommentLikeList(fsUserVideoCommentLike);
        ExcelUtil<FsUserVideoCommentLike> util = new ExcelUtil<FsUserVideoCommentLike>(FsUserVideoCommentLike.class);
        return util.exportExcel(list, "课堂评论点赞数据");
    }

    /**
     * 获取课堂评论点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsUserVideoCommentLikeService.selectFsUserVideoCommentLikeById(id));
    }

    /**
     * 新增课堂评论点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:add')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsUserVideoCommentLike fsUserVideoCommentLike)
    {
        return toAjax(fsUserVideoCommentLikeService.insertFsUserVideoCommentLike(fsUserVideoCommentLike));
    }

    /**
     * 修改课堂评论点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:edit')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsUserVideoCommentLike fsUserVideoCommentLike)
    {
        return toAjax(fsUserVideoCommentLikeService.updateFsUserVideoCommentLike(fsUserVideoCommentLike));
    }

    /**
     * 删除课堂评论点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userVideoCommentLike:remove')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fsUserVideoCommentLikeService.deleteFsUserVideoCommentLikeByIds(ids));
    }
}
