rename the file
This commit is contained in:
@@ -7,16 +7,13 @@ 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 com.peanut.modules.book.service.ShopProudictBookService;
|
||||
import com.peanut.modules.book.service.ShopProductBookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("book/teach")
|
||||
public class BookTeachController {
|
||||
@@ -25,123 +22,82 @@ public class BookTeachController {
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
@Autowired
|
||||
private ShopProudictBookService shopProudictBookService;
|
||||
private ShopProductBookService shopProductBookService;
|
||||
|
||||
/**
|
||||
* 获取讲书列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getTeachBooks")
|
||||
public R getTeachBooks(@RequestParam Integer limit,@RequestParam Integer page){
|
||||
public R getTeachBooks(@RequestParam Integer limit, @RequestParam Integer page) {
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getTeachIn,1);
|
||||
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 R.ok().put("page", bookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取讲书目录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getBookTeachItems")
|
||||
public R getBookTeachItems(@RequestParam Integer bookId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
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.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);
|
||||
return R.ok().put("page", bookTeachEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取讲书的详情
|
||||
*
|
||||
* @param teachId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getTeachDetail")
|
||||
public R getTeachDetail(@RequestParam Integer teachId){
|
||||
public R getTeachDetail(@RequestParam Integer teachId) {
|
||||
BookTeachEntity teach_info = bookTeachService.getById(teachId);
|
||||
Integer productByBookId = shopProudictBookService.getProductByBookId(teach_info.getBookId());
|
||||
return R.ok().put("bookTeach",teach_info).put("product",productByBookId);
|
||||
Integer productByBookId = shopProductBookService.getProductByBookId(teach_info.getBookId());
|
||||
return R.ok().put("bookTeach", teach_info).put("product", productByBookId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加讲书
|
||||
* @return
|
||||
*/
|
||||
// @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){
|
||||
public R addTeach1(@RequestBody BookTeachEntity bookTeach) {
|
||||
bookTeachService.save(bookTeach);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除讲书章节
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/delTeach")
|
||||
public R delTeach(@RequestBody BookTeachEntity bookTeach){
|
||||
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 bookTeach){
|
||||
public R updateTeach(@RequestBody BookTeachEntity bookTeach) {
|
||||
bookTeachService.updateById(bookTeach);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user