• 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'
            })
        } 
  • 相关阅读:
    什么是静态测试、动态测试、黑盒测试、白盒测试、α测试 β测试
    软件产品质量特性
    目前主要的测试用例设计方法是什么?
    软件的安全性应从哪几个方面去测试?
    软件配置管理的作用?软件配置包括什么?
    HDOJ1003(DP)
    HDOJ5650
    POJ1068(模拟)
    POJ2586(贪心)
    HDOJ1548(BFS)
  • 原文地址:https://www.cnblogs.com/zjazn/p/14451851.html
Copyright © 2020-2023  润新知