CourseDictController.java 2.55 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.course.QueryCoursesDTO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.service.CourseDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;

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

    @Autowired
    private CourseDictService courseDictService;

    @PostMapping("addCourse")
    @ApiOperation("添加课程 **companyId courseName categoryId courseType  courseSource")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){
        return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO));
    }

    @PostMapping("deleteCourse")
    @ApiOperation("删除课程 id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
        return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO));
    }

    @PostMapping("queryCourses")
    @ApiOperation("平台运营者--查询课程 pageSize pageNum  administerId companyId courseName categoryId courseType  courseSource")
    //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
        return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
    }

    @PostMapping("updateCourses")
    @ApiOperation("编辑课程 id ** companyId courseName categoryId courseType  courseSource")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){
        return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO));
    }

    @PostMapping("queryCompanyCourse")
    @ApiOperation("企业内容管理-- { ** companyId 所选企业id}")
    public ResponseVO queryCompanyCourse(@RequestBody QueryCoursesDTO queryCoursesDTO){
        return ResponseData.generateCreatedResponse(0,courseDictService.queryCompanyCourse(queryCoursesDTO));
    }


}