From e42d0243cd4c10c659b27d79cb9aa702d7516900 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Tue, 26 Sep 2023 14:12:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookForumArticlesServiceController.java | 12 +++ .../book/controller/BookTeachController.java | 92 +++++++++++++------ src/main/resources/application-dev.yml | 4 +- 3 files changed, 77 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java index 6a408191..78c1a62b 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java @@ -208,6 +208,18 @@ public class BookForumArticlesServiceController { return R.ok().put("page",bookForumCommentEntityPage); } + /** + * + * @param forumId + * @return + */ + @RequestMapping("/getForumdetail") + public R getForumdetail(@RequestParam Integer forumId){ + + + return R.ok(); + } + /** * 获取子聊天项目 * @return diff --git a/src/main/java/com/peanut/modules/book/controller/BookTeachController.java b/src/main/java/com/peanut/modules/book/controller/BookTeachController.java index 9f30f893..d8200713 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookTeachController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookTeachController.java @@ -1,7 +1,6 @@ package com.peanut.modules.book.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.peanut.common.utils.R; import com.peanut.modules.book.entity.BookEntity; @@ -65,45 +64,80 @@ public class BookTeachController { } + /** - * 保存 + * 添加讲书 + * @return */ - @RequestMapping("/saveTeach") - public R save(@RequestBody BookTeachEntity bookTeachEntity) { - bookTeachService.save(bookTeachEntity); +// @RequestMapping("/addTeach") +// public R addTeach(@RequestParam Integer bookId, +// @RequestParam Integer chapter, +// @RequestParam String title, +// @RequestParam String voices, +// @RequestParam String content){ +// BookTeachEntity bookTeachEntity = new BookTeachEntity(); +// bookTeachEntity.setBookId(bookId); +// bookTeachEntity.setChapter(chapter); +// bookTeachEntity.setTitle(title); +// bookTeachEntity.setVoices(voices); +// bookTeachEntity.setContent(content); +// bookTeachService.save(bookTeachEntity); +// +// return R.ok(); +// } + + /** + * 添加讲书的章节 + * @param bookTeach + * @return + */ + @RequestMapping("/addTeach1") + public R addTeach1(@RequestBody BookTeachEntity bookTeach){ + bookTeachService.save(bookTeach); return R.ok(); } + /** + * 删除讲书章节 + * @return + */ + @RequestMapping("/delTeach") + public R delTeach(@RequestBody BookTeachEntity bookTeach){ + bookTeachService.removeById(bookTeach.getTeachId()); + return R.ok(); + } /** - * 修改 + * 编辑讲书的章节 + * @return + */ +// @RequestMapping("/updateTeach") +// public R updateTeach(@RequestParam Integer teachId, +// @RequestParam Integer chapter, +// @RequestParam String title, +// @RequestParam String voices, +// @RequestParam String content){ +// +// BookTeachEntity bookTeachEntity = new BookTeachEntity(); +// bookTeachEntity.setTeachId(teachId); +// bookTeachEntity.setTitle(title); +// bookTeachEntity.setVoices(voices); +// bookTeachEntity.setContent(content); +// bookTeachService.updateById(bookTeachEntity); +// return R.ok(); +// +// } + + /** + * 编辑讲书的章节 + * @return */ @RequestMapping("/updateTeach") - public R updateTeach(@RequestBody BookTeachEntity bookTeachEntity) { - - Integer bookId = bookTeachEntity.getBookId(); - List list = new ArrayList<>(); - List bookTeachEntities = this.bookTeachService.getBaseMapper().selectList(new QueryWrapper() - .eq("book_id", bookId) - ); - for(BookTeachEntity entity: bookTeachEntities){ - entity.setChapter(entity.getChapter() + 1); - this.bookTeachService.updateById(entity); - } -// int[] intArray = list.stream().mapToInt(Integer::intValue).toArray(); -// for (int i = 0; i < intArray.length; i++) { -// int current = intArray[i]; -// int j = i - 1; -// while (j >= 0 && intArray[j] > current) { -// intArray[j + 1] = intArray[j]; -// j--; -// } -// intArray[j + 1] = current; -// } - - this.bookTeachService.updateById(bookTeachEntity); + public R updateTeach(@RequestBody BookTeachEntity bookTeach){ + bookTeachService.updateById(bookTeach); return R.ok(); } + } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index b947a7ac..d988a23f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,8 +3,8 @@ spring: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true -# url: jdbc:mysql://59.110.212.44:3306/e_book?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true +# url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true + url: jdbc:mysql://59.110.212.44:3306/e_book?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true username: root password: HSXY1234hsxy initial-size: 10