CourseDictController.java 2.2 KB
package com.zhongzhi.controller;


import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.course.CoursesDTO;
import com.zhongzhi.model.CourseDictDO;
import com.zhongzhi.service.CourseDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
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;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2022-11-14
 */
@RestController
@RequestMapping("/courseDict")
@Api(tags = "课程字典表")
public class CourseDictController {


    @Autowired
    private CourseDictService courseDictService;

    @PostMapping("addCourse")
    @ApiOperation("添加课程  courseName")
    public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO) {
        courseDictService.addCourse(courseDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("updateCourse")
    @ApiOperation("编辑课程  id  courseName")
    public ResponseVO updateCourse(@RequestBody CourseDictDO courseDictDO){
        courseDictService.updateCourse(courseDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("courses")
    @ApiOperation("查询所有课程(+视频数量)  pageSize  pageNo  courseName")
    public ResponseVO courses(@RequestBody CoursesDTO coursesDTO){
        return ResponseData.generateCreatedResponse(0,courseDictService.courses(coursesDTO));
    }

    @PostMapping("deleteCourse")
    @ApiOperation("删除某个课程 id 课程id")
    public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
        courseDictService.deleteCourse(courseDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("courseVods")
    @ApiOperation("课程+视频")
    public ResponseVO courseVods(@RequestBody CourseDictDO courseDictDO){
        return ResponseData.generateCreatedResponse(0,courseDictService.courseVods(courseDictDO));
    }


}