Blame view

CourseDictController.java 2.2 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
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));
    }


}