zoukankan      html  css  js  c++  java
  • mp service层 增删改查

    后端:
    //添加章节
    @PostMapping("addChapter")
    public R addChapter(@RequestBody EduChapter eduChapter) {
    chapterService.save(eduChapter);
    return R.ok();
    }

    //根据章节id查询
    @GetMapping("getChapterInfo/{chapterId}")
    public R getChapterInfo(@PathVariable String chapterId) {
    EduChapter eduChapter = chapterService.getById(chapterId);
    return R.ok().data("chapter",eduChapter);

    }

    //修改章节
    @PostMapping("updateChapter")
    public R updateChapter(@RequestBody EduChapter eduChapter) {
    chapterService.updateById(eduChapter);
    return R.ok();
    }

    //删除的方法
    @DeleteMapping("{chapterId}")
    public R deleteChapter(@PathVariable String chapterId) {
    chapterService.removeById(chapterId);
    return R.ok();
    }

    前端使用:
    //添加章节
        addChapter(chapter) {
            return request({
                url: '/eduservice/chapter/addChapter',
                method: 'post',
                data:chapter
            })
        },
        //根据id查询章节
        getChapter(courseId) {
            return request({
                url: '/eduservice/chapter/getChapterInfo/'+courseId,
                method: 'get'
            })
        },
        //修改章节
        updateChapter(chapter) {
            return request({
                url: '/eduservice/chapter/updateChapter',
                method: 'post',
                data: 'chapter'
            })
        },
        //删除章节
        deleteChapter(chapterId) {
            return request({
                url: '/eduservice/chapter/'+chapterId,
                method: 'delete'
            })
        } 
  • 相关阅读:
    弱智儿童欢乐多游戏android源码完整版
    小龙吃水果游戏IOS源码 V1.0
    PHP实现的轩宇淘宝客系统源码v2.0.1
    友点企业网站管理系统集电脑网站、手机网站、微信三站合一
    仿win8磁贴界面以及功能
    HarestGame史上最难游戏源码 v2.0
    关于js基本类型string
    本周作业
    罗辑思维 怎样成为一个高手
    第18周作业
  • 原文地址:https://www.cnblogs.com/zjazn/p/14451851.html
Copyright © 2011-2022 走看看