新版
This commit is contained in:
@@ -1,11 +1,62 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.BookTeachEntity;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.BookTeachService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("book/teach")
|
||||
public class BookTeachController {
|
||||
@Autowired
|
||||
private BookTeachService bookTeachService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 获取讲书列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getTeachBooks")
|
||||
public R getTeachBooks(@RequestParam Integer limit,@RequestParam Integer page){
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getTeachIn,1);
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<BookEntity>(page, limit), wrapper);
|
||||
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取讲书目录
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getBookTeachItems")
|
||||
public R getBookTeachItems(@RequestParam Integer bookId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
LambdaQueryWrapper<BookTeachEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookTeachEntity::getBookId,bookId);
|
||||
wrapper.eq(BookTeachEntity::getDelFlag,0);
|
||||
wrapper.orderByAsc(BookTeachEntity::getChapter);
|
||||
Page<BookTeachEntity> bookTeachEntityPage = bookTeachService.getBaseMapper().selectPage(new Page<BookTeachEntity>(page, limit), wrapper);
|
||||
return R.ok().put("page",bookTeachEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取讲书的详情
|
||||
* @param teachId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getTeachDetail")
|
||||
public R getTeachDetail(@RequestParam Integer teachId){
|
||||
BookTeachEntity byId = bookTeachService.getById(teachId);
|
||||
return R.ok().put("bookTeach",byId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user