1、控制层:CourseController
package cn.org.xcore.edusys.controller.course;
import cn.org.xcore.edusys.common.bean.ApiResponse;
import cn.org.xcore.edusys.db.basic.model.Course;
import cn.org.xcore.edusys.db.ext.model.Performance;
import cn.org.xcore.edusys.service.CourseService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 课程接口
*
* @author 李海林 手机:13802780104|微信:lihailin9073|Email:767679879@qq.com
* @copyright 个人开发者李海林版权所有,产品详情及技术服务请登录官网查询[http://www.x-core.org.cn]
* @create 2019-08-23 07:12
*/
@Api(tags = "05-课程模块")
@RestController
@RequestMapping("/course")
public class CourseController {
@Autowired
private CourseService courseService;
@ApiOperation("创建课程")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "name"),
@ApiImplicitParam(paramType = "query", name = "hours"),
@ApiImplicitParam(paramType = "query", name = "price"),
@ApiImplicitParam(paramType = "query", name = "typeId"),
@ApiImplicitParam(paramType = "query", name = "deptId"),
@ApiImplicitParam(paramType = "query", name = "teacherId"),
@ApiImplicitParam(paramType = "query", name = "description"),
})
@PostMapping("/add")
public ApiResponse create(Course course) {
int res = courseService.save(course);
if (res>0) {
return ApiResponse.success("操作成功!");
}
return ApiResponse.error("操作失败!");
}
@ApiOperation("更新课程")
@PutMapping("/update")
@ApiImplicitParams({