package com.fjhx.controller.video;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.params.video.VideoInfoVo;
import com.fjhx.service.video.VideoInfoService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-08-08
 */
@RestController
@RequestMapping("/videoInfo")
public class VideoInfoController {

    @Autowired
    private VideoInfoService videoInfoService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition) {
        Page<Map<String, Object>> result = videoInfoService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody VideoInfoVo videoInfoVo) {
        videoInfoService.add(videoInfoVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody VideoInfoVo videoInfoVo) {
        videoInfoService.edit(videoInfoVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody VideoInfoVo videoInfoVo) {
        videoInfoService.delete(videoInfoVo);
        return R.success();
    }

    @PostMapping("/details")
    public R details(@RequestBody VideoInfoVo videoInfoVo) {
        Map<String, Object> result = videoInfoService.details(videoInfoVo);
        return R.success(result);
    }

}

