ContentVodMappingController.java 2.47 KB
package com.subsidy.controller;

import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.dto.contentVod.AddContentVod;
import com.subsidy.dto.contentVod.ContentVodDTO;
import com.subsidy.dto.vod.ChangeOrdersDTO;
import com.subsidy.service.ContentVodMappingService;
import io.swagger.annotations.ApiOperation;
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 io.swagger.annotations.Api;

/**
 * <p>
 * 目录视频关系表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2022-07-19
 */
@RestController
@Api(tags = "目录视频关系表")
@RequestMapping("/contentVodMapping")
public class ContentVodMappingController {

    @Autowired
    private ContentVodMappingService contentVodMappingService;

    @PostMapping("getContendVods")
    @ApiOperation("获取课程内容下的视频 {contentId  vodName}")
    @LoginRequired
    public ResponseVO getContendVods(@RequestBody GetContendVodsDTO getContendVodsDTO) {
        return ResponseData.generateCreatedResponse(0, contentVodMappingService.getContendVods(getContendVodsDTO));
    }

    @PostMapping("changeContentVodOrders")
    @ApiOperation("课程内容视频排序 contentId/内容ID vodIds [] 视频的id")
    public ResponseVO changeContentVodOrders(@RequestBody ChangeOrdersDTO changeOrdersDTO ){
        contentVodMappingService.changeContentVodOrders(changeOrdersDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("addContentVod")
    @ApiOperation("添加课程内容视频:contentId/内容ID、vodIds [] /视频ID")
    @LoginRequired
    public ResponseVO addContentVod(@RequestBody AddContentVod addContentVod) {
        contentVodMappingService.addContentVod(addContentVod);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("deleteContentVod")
    @ApiOperation("删除课程内容下的视频: contentId/内容ID 、 vodId/视频ID")
    @LoginRequired
    public ResponseVO deleteContentVod(@RequestBody ContentVodDTO contentVodDTO) {
        contentVodMappingService.deleteContentVod(contentVodDTO);
        return ResponseData.generateCreatedResponse(0);
    }

}