CourseContentController.java 2.35 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.CourseContentDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.CourseContentService;
import com.subsidy.util.ConstantUtils;
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 2021-10-11
 */
@RestController
@Api(tags = "课程目录表")
@RequestMapping("/courseContent")
public class CourseContentController {

    @Autowired
    private CourseContentService courseContentService;

    @PostMapping("getContents")
    @ApiOperation("获取课程目录 {courseId}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){
        return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO));
    }

    @PostMapping("deleteContent")
    @ApiOperation("删除一个目录 {id} ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){
        return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO));
    }

    @PostMapping("addContent")
    @ApiOperation("添加一个目录 {courseId content}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){
        return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO));
    }

    @PostMapping("updateContent")
    @ApiOperation("更新一个目录  {id  courseId  content}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){
        return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO));
    }


}