package com.fjhx.controller.video;

import com.alibaba.fastjson.JSONObject;
import com.fjhx.params.video.VideoClassifyVo;
import com.fjhx.service.video.VideoClassifyService;
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.List;
import java.util.Map;

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

    @Autowired
    private VideoClassifyService videoClassifyService;

    @PostMapping("/tree")
    public R tree(@RequestBody Map<String, String> condition) {
        List<JSONObject> result = videoClassifyService.getTree(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody VideoClassifyVo videoClassifyVo) {
        videoClassifyService.add(videoClassifyVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody VideoClassifyVo videoClassifyVo) {
        videoClassifyService.edit(videoClassifyVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody VideoClassifyVo videoClassifyVo) {
        videoClassifyService.delete(videoClassifyVo);
        return R.success();
    }

}

