package com.fs.course.controller;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.course.domain.FsUserCourseCommentLike;
import com.fs.course.service.IFsUserCourseCommentLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 课堂评论点赞Controller
 *
 * @author fs
 * @date 2024-05-15
 */
@RestController
@RequestMapping("/course/userCourseCommentLike")
public class FsUserCourseCommentLikeController extends BaseController
{
    @Autowired
    private IFsUserCourseCommentLikeService fsUserCourseCommentLikeService;

    /**
     * 查询课堂评论点赞列表
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseCommentLike:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsUserCourseCommentLike fsUserCourseCommentLike)
    {
        startPage();
        List<FsUserCourseCommentLike> list = fsUserCourseCommentLikeService.selectFsUserCourseCommentLikeList(fsUserCourseCommentLike);
        return getDataTable(list);
    }

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

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

    /**
     * 新增课堂评论点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseCommentLike:add')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsUserCourseCommentLike fsUserCourseCommentLike)
    {
        return toAjax(fsUserCourseCommentLikeService.insertFsUserCourseCommentLike(fsUserCourseCommentLike));
    }

    /**
     * 修改课堂评论点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseCommentLike:edit')")
    @Log(title = "课堂评论点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsUserCourseCommentLike fsUserCourseCommentLike)
    {
        return toAjax(fsUserCourseCommentLikeService.updateFsUserCourseCommentLike(fsUserCourseCommentLike));
    }

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