package com.ruoyi.abuwx.controller;

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

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 视频管理操作记录Controller
 * 
 * @author lujie
 * @date 2025-01-10
 */
@RestController
@RequestMapping("/video/operationRecord")
public class VideoOperationRecordController extends BaseController
{
    @Autowired
    private IVideoOperationRecordService videoOperationRecordService;

    /**
     * 查询视频管理操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(VideoOperationRecord videoOperationRecord)
    {
        startPage();
        List<VideoOperationRecord> list = videoOperationRecordService.selectVideoOperationRecordList(videoOperationRecord);
        return getDataTable(list);
    }

    /**
     * 导出视频管理操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:export')")
    @Log(title = "视频管理操作记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VideoOperationRecord videoOperationRecord)
    {
        List<VideoOperationRecord> list = videoOperationRecordService.selectVideoOperationRecordList(videoOperationRecord);
        ExcelUtil<VideoOperationRecord> util = new ExcelUtil<VideoOperationRecord>(VideoOperationRecord.class);
        util.exportExcel(response, list, "视频管理操作记录数据");
    }

    /**
     * 获取视频管理操作记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(videoOperationRecordService.selectVideoOperationRecordById(id));
    }

    /**
     * 新增视频管理操作记录
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:add')")
    @Log(title = "视频管理操作记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VideoOperationRecord videoOperationRecord)
    {
        return toAjax(videoOperationRecordService.insertVideoOperationRecord(videoOperationRecord));
    }

    /**
     * 修改视频管理操作记录
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:edit')")
    @Log(title = "视频管理操作记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VideoOperationRecord videoOperationRecord)
    {
        return toAjax(videoOperationRecordService.updateVideoOperationRecord(videoOperationRecord));
    }

    /**
     * 删除视频管理操作记录
     */
    @PreAuthorize("@ss.hasPermi('video:operationRecord:remove')")
    @Log(title = "视频管理操作记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(videoOperationRecordService.deleteVideoOperationRecordByIds(ids));
    }
}
