package com.fs.app.controller.live;

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.live.domain.LiveUserLike;
import com.fs.live.service.ILiveUserLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户直播赞Controller
 *
 * @author fs
 * @date 2025-07-11
 */
@RestController
@RequestMapping("/app/live/liveUserLike")
public class LiveUserLikeController extends BaseController
{
    @Autowired
    private ILiveUserLikeService liveUserLikeService;

    /**
     * 查询用户直播赞列表
     */
    @GetMapping("/list")
    public TableDataInfo list(LiveUserLike liveUserLike)
    {
        startPage();
        List<LiveUserLike> list = liveUserLikeService.selectLiveUserLikeList(liveUserLike);
        return getDataTable(list);
    }

    /**
     * 导出用户直播赞列表
     */
    @Log(title = "用户直播赞", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LiveUserLike liveUserLike)
    {
        List<LiveUserLike> list = liveUserLikeService.selectLiveUserLikeList(liveUserLike);
        ExcelUtil<LiveUserLike> util = new ExcelUtil<LiveUserLike>(LiveUserLike.class);
        return util.exportExcel(list, "用户直播赞数据");
    }

    /**
     * 获取用户直播赞详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(liveUserLikeService.selectLiveUserLikeById(id));
    }

    /**
     * 新增用户直播赞
     */
    @Log(title = "用户直播赞", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiveUserLike liveUserLike)
    {
        return toAjax(liveUserLikeService.insertLiveUserLike(liveUserLike));
    }

    /**
     * 修改用户直播赞
     */
    @Log(title = "用户直播赞", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiveUserLike liveUserLike)
    {
        return toAjax(liveUserLikeService.updateLiveUserLike(liveUserLike));
    }

    /**
     * 删除用户直播赞
     */
    @Log(title = "用户直播赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(liveUserLikeService.deleteLiveUserLikeByIds(ids));
    }
}
