mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
feat: 新增小说章节列表查询接口
This commit is contained in:
parent
cd39bade6d
commit
403624f043
@ -2,10 +2,7 @@ package io.github.xxyopen.novel.controller.front;
|
|||||||
|
|
||||||
import io.github.xxyopen.novel.core.constant.ApiRouterConsts;
|
import io.github.xxyopen.novel.core.constant.ApiRouterConsts;
|
||||||
import io.github.xxyopen.novel.core.common.resp.RestResp;
|
import io.github.xxyopen.novel.core.common.resp.RestResp;
|
||||||
import io.github.xxyopen.novel.dto.resp.BookChapterAboutRespDto;
|
import io.github.xxyopen.novel.dto.resp.*;
|
||||||
import io.github.xxyopen.novel.dto.resp.BookContentAboutRespDto;
|
|
||||||
import io.github.xxyopen.novel.dto.resp.BookInfoRespDto;
|
|
||||||
import io.github.xxyopen.novel.dto.resp.BookRankRespDto;
|
|
||||||
import io.github.xxyopen.novel.service.BookService;
|
import io.github.xxyopen.novel.service.BookService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -58,6 +55,14 @@ public class BookController {
|
|||||||
return bookService.listRecBooks(bookId);
|
return bookService.listRecBooks(bookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说章节列表查询接口
|
||||||
|
* */
|
||||||
|
@GetMapping("chapterList")
|
||||||
|
public RestResp<List<BookChapterRespDto>> listChapters(Long bookId){
|
||||||
|
return bookService.listChapters(bookId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小说内容相关信息查询接口
|
* 小说内容相关信息查询接口
|
||||||
* */
|
* */
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package io.github.xxyopen.novel.service;
|
package io.github.xxyopen.novel.service;
|
||||||
|
|
||||||
import io.github.xxyopen.novel.core.common.resp.RestResp;
|
import io.github.xxyopen.novel.core.common.resp.RestResp;
|
||||||
import io.github.xxyopen.novel.dto.resp.BookChapterAboutRespDto;
|
import io.github.xxyopen.novel.dto.resp.*;
|
||||||
import io.github.xxyopen.novel.dto.resp.BookContentAboutRespDto;
|
|
||||||
import io.github.xxyopen.novel.dto.resp.BookInfoRespDto;
|
|
||||||
import io.github.xxyopen.novel.dto.resp.BookRankRespDto;
|
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -66,4 +63,9 @@ public interface BookService {
|
|||||||
* 获取下一章节ID
|
* 获取下一章节ID
|
||||||
* */
|
* */
|
||||||
RestResp<Long> nextChapterId(Long chapterId);
|
RestResp<Long> nextChapterId(Long chapterId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说章节列表查询
|
||||||
|
* */
|
||||||
|
RestResp<List<BookChapterRespDto>> listChapters(Long bookId);
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,17 @@ public class BookServiceImpl implements BookService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResp<List<BookChapterRespDto>> listChapters(Long bookId) {
|
||||||
|
QueryWrapper<BookChapter> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(DatabaseConsts.BookChapterTable.ColumnEnum.BOOK_ID.getName(), bookId)
|
||||||
|
.orderByAsc(DatabaseConsts.BookChapterTable.ColumnEnum.CHAPTER_NUM.getName());
|
||||||
|
return RestResp.ok(bookChapterMapper.selectList(queryWrapper).stream().map(v -> BookChapterRespDto.builder()
|
||||||
|
.id(v.getId())
|
||||||
|
.chapterName(v.getChapterName())
|
||||||
|
.build()).toList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResp<BookContentAboutRespDto> getBookContentAbout(Long chapterId) {
|
public RestResp<BookContentAboutRespDto> getBookContentAbout(Long chapterId) {
|
||||||
// 查询章节信息
|
// 查询章节信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user