This commit is contained in:
wangjinlei
2023-09-26 14:12:23 +08:00
parent ede49d670c
commit e42d0243cd
3 changed files with 77 additions and 31 deletions

View File

@@ -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

View File

@@ -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<Integer> list = new ArrayList<>();
List<BookTeachEntity> bookTeachEntities = this.bookTeachService.getBaseMapper().selectList(new QueryWrapper<BookTeachEntity>()
.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();
}
}