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.FsUserCourseNoteLike;
import com.fs.course.service.IFsUserCourseNoteLikeService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 课堂笔记点赞Controller
 * 
 * @author fs
 * @date 2024-05-15
 */
@RestController
@RequestMapping("/course/userCourseNoteLike")
public class FsUserCourseNoteLikeController extends BaseController
{
    @Autowired
    private IFsUserCourseNoteLikeService fsUserCourseNoteLikeService;

    /**
     * 查询课堂笔记点赞列表
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseNoteLike:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsUserCourseNoteLike fsUserCourseNoteLike)
    {
        startPage();
        List<FsUserCourseNoteLike> list = fsUserCourseNoteLikeService.selectFsUserCourseNoteLikeList(fsUserCourseNoteLike);
        return getDataTable(list);
    }

    /**
     * 导出课堂笔记点赞列表
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseNoteLike:export')")
    @Log(title = "课堂笔记点赞", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsUserCourseNoteLike fsUserCourseNoteLike)
    {
        List<FsUserCourseNoteLike> list = fsUserCourseNoteLikeService.selectFsUserCourseNoteLikeList(fsUserCourseNoteLike);
        ExcelUtil<FsUserCourseNoteLike> util = new ExcelUtil<FsUserCourseNoteLike>(FsUserCourseNoteLike.class);
        return util.exportExcel(list, "课堂笔记点赞数据");
    }

    /**
     * 获取课堂笔记点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseNoteLike:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsUserCourseNoteLikeService.selectFsUserCourseNoteLikeById(id));
    }

    /**
     * 新增课堂笔记点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseNoteLike:add')")
    @Log(title = "课堂笔记点赞", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsUserCourseNoteLike fsUserCourseNoteLike)
    {
        return toAjax(fsUserCourseNoteLikeService.insertFsUserCourseNoteLike(fsUserCourseNoteLike));
    }

    /**
     * 修改课堂笔记点赞
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseNoteLike:edit')")
    @Log(title = "课堂笔记点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsUserCourseNoteLike fsUserCourseNoteLike)
    {
        return toAjax(fsUserCourseNoteLikeService.updateFsUserCourseNoteLike(fsUserCourseNoteLike));
    }

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