VideoController.java 1.51 KB
package com.bsth.controller.video;

import com.alibaba.fastjson.JSON;
import com.bsth.common.ResponseCode;
import com.bsth.entity.Business;
import com.bsth.entity.Line;
import com.bsth.entity.video.VideoTree;
import com.bsth.service.BusinessService;
import com.bsth.service.LineService;
import com.bsth.service.video.VideoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author liujun
 * @date 2024年07月01日 12:52
 */
@RestController
@Slf4j
@RequestMapping("video")
public class VideoController {
    @Autowired
    private VideoService videoService;

    @GetMapping("/tree")
    public Map<String, Object> combinationTree() {
        Map<String, Object> result = new HashMap<>();
        try {
            List<VideoTree> trees = videoService.combinationTree();
            result.put("status", ResponseCode.SUCCESS);
            result.put("data", trees);
        } catch (Exception e) {
            log.error("查询视频树异常", e);
            result.put("status", ResponseCode.ERROR);
        }

        return result;
    }

    @GetMapping("/tree1")
    public String combinationTree1() {
        List<VideoTree> trees = videoService.combinationTree();
        return JSON.toJSONString(trees);

    }
}