03 微架构教务系统——课程创建接口、课程更新接口、课程删除接口

本文介绍了微架构教务系统中课程管理的相关接口实现,包括课程创建、更新和删除。在控制层CourseController中定义了相关操作,在服务层CourseService和CourseServiceImpl中实现了业务逻辑。数据层借助MyBatis Generator自动生成,分为基本模块basic和扩展模块ext,以灵活应对数据库的变更。
摘要由CSDN通过智能技术生成

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({
         
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值