forum bug

This commit is contained in:
wangjinlei
2023-10-13 17:30:00 +08:00
parent 5d0633d1bb
commit 93eddae8f0

View File

@@ -71,6 +71,7 @@ public class BookForumArticlesServiceController {
wrapper.leftJoin(AuthorEntity.class,AuthorEntity::getId,BookEntity::getAuthorId);
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getState,0);
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesDao.selectJoinPage(new Page<>(page, limit), BookForumArticlesEntity.class, wrapper);
for (BookForumArticlesEntity b : bookForumArticlesEntityPage.getRecords()){
@@ -102,6 +103,7 @@ public class BookForumArticlesServiceController {
wrapper.leftJoin(AuthorEntity.class,AuthorEntity::getId,BookEntity::getAuthorId);
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getState,0);
wrapper.orderByDesc(BookForumArticlesEntity::getContlike);
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesDao.selectJoinPage(new Page<>(page, limit), BookForumArticlesEntity.class, wrapper);
@@ -152,6 +154,7 @@ public class BookForumArticlesServiceController {
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getState,0);
wrapper.exists(ex_sql);
wrapper.exists(existSql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
@@ -173,10 +176,11 @@ public class BookForumArticlesServiceController {
@RequestMapping("/getBestForumsAndBook")
public R getBestForumsAndBook(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
String ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
String existSql = "select 1 from book_forum_articles where book.id = bookid";
String existSql = "select 1 from book_forum_articles where book.id = bookid and del_flag = 0";
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getState,0);
wrapper.notExists(ex_sql);
wrapper.exists(existSql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);