mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
feat: 增加小说发布章节列表查询接口
This commit is contained in:
parent
fa47081398
commit
066dd0f13e
@ -8,6 +8,7 @@ import io.github.xxyopen.novel.core.constant.ApiRouterConsts;
|
|||||||
import io.github.xxyopen.novel.dto.req.AuthorRegisterReqDto;
|
import io.github.xxyopen.novel.dto.req.AuthorRegisterReqDto;
|
||||||
import io.github.xxyopen.novel.dto.req.BookAddReqDto;
|
import io.github.xxyopen.novel.dto.req.BookAddReqDto;
|
||||||
import io.github.xxyopen.novel.dto.req.ChapterAddReqDto;
|
import io.github.xxyopen.novel.dto.req.ChapterAddReqDto;
|
||||||
|
import io.github.xxyopen.novel.dto.resp.BookChapterRespDto;
|
||||||
import io.github.xxyopen.novel.dto.resp.BookInfoRespDto;
|
import io.github.xxyopen.novel.dto.resp.BookInfoRespDto;
|
||||||
import io.github.xxyopen.novel.service.AuthorService;
|
import io.github.xxyopen.novel.service.AuthorService;
|
||||||
import io.github.xxyopen.novel.service.BookService;
|
import io.github.xxyopen.novel.service.BookService;
|
||||||
@ -63,4 +64,12 @@ public class AuthorController {
|
|||||||
return bookService.saveBookChapter(dto);
|
return bookService.saveBookChapter(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说发布章节列表查询接口
|
||||||
|
*/
|
||||||
|
@GetMapping("book/chapters/{bookId}")
|
||||||
|
public RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(@PathVariable("bookId") Long bookId, PageReqDto dto) {
|
||||||
|
return bookService.listBookChapters(bookId, dto);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,4 +170,13 @@ public interface BookService {
|
|||||||
* @return 小说分页列表数据
|
* @return 小说分页列表数据
|
||||||
*/
|
*/
|
||||||
RestResp<PageRespDto<BookInfoRespDto>> listAuthorBooks(PageReqDto dto);
|
RestResp<PageRespDto<BookInfoRespDto>> listAuthorBooks(PageReqDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小说发布章节列表
|
||||||
|
*
|
||||||
|
* @param bookId 小说ID
|
||||||
|
* @param dto 分页请求参数
|
||||||
|
* @return 章节分页列表数据
|
||||||
|
*/
|
||||||
|
RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(Long bookId, PageReqDto dto);
|
||||||
}
|
}
|
||||||
|
@ -370,6 +370,23 @@ public class BookServiceImpl implements BookService {
|
|||||||
.build()).toList()));
|
.build()).toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(Long bookId, PageReqDto dto) {
|
||||||
|
IPage<BookChapter> page = new Page<>();
|
||||||
|
page.setCurrent(dto.getPageNum());
|
||||||
|
page.setSize(dto.getPageSize());
|
||||||
|
QueryWrapper<BookChapter> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(DatabaseConsts.BookChapterTable.COLUMN_BOOK_ID, bookId)
|
||||||
|
.orderByDesc(DatabaseConsts.BookChapterTable.COLUMN_CHAPTER_NUM);
|
||||||
|
IPage<BookChapter> bookChapterPage = bookChapterMapper.selectPage(page, queryWrapper);
|
||||||
|
return RestResp.ok(PageRespDto.of(dto.getPageNum(), dto.getPageSize(), page.getTotal(),
|
||||||
|
bookChapterPage.getRecords().stream().map(v -> BookChapterRespDto.builder()
|
||||||
|
.id(v.getId())
|
||||||
|
.chapterName(v.getChapterName())
|
||||||
|
.chapterUpdateTime(v.getUpdateTime())
|
||||||
|
.build()).toList()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResp<BookContentAboutRespDto> getBookContentAbout(Long chapterId) {
|
public RestResp<BookContentAboutRespDto> getBookContentAbout(Long chapterId) {
|
||||||
log.debug("userId:{}", UserHolder.getUserId());
|
log.debug("userId:{}", UserHolder.getUserId());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user