This commit is contained in:
wangjinlei
2023-10-12 14:52:11 +08:00
parent 75560923b0
commit b671871a28

View File

@@ -8,6 +8,7 @@ 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.ShopProductBookService;
import com.peanut.modules.book.to.PageIdDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -67,6 +68,39 @@ public class BookTeachController {
return R.ok().put("bookTeach", teach_info).put("product", productByBookId);
}
/**
* 获取讲书的已购列表
* @param pageIdDto
* @return
*/
@RequestMapping("/getUserTeachBooks")
public R getUserTeachBooks(@RequestBody PageIdDto pageIdDto){
String exist_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+pageIdDto.getId();
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getTeachIn,1);
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.exists(exist_sql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(pageIdDto.getPage(), pageIdDto.getLimit()), wrapper);
return R.ok().put("page",bookEntityPage);
}
/**
* 获取讲书的推荐列表
* @param pageIdDto
* @return
*/
@RequestMapping("/getUserBestTeachBooks")
public R getUserBestTeachBooks(@RequestBody PageIdDto pageIdDto){
String exist_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+pageIdDto.getId();
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getTeachIn,1);
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.notExists(exist_sql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(pageIdDto.getPage(), pageIdDto.getLimit()), wrapper);
return R.ok().put("page",bookEntityPage);
}
/**
* 添加讲书的章节
*