|
@@ -24,27 +24,21 @@ import java.util.List;
|
|
* @since 2024-05-25
|
|
* @since 2024-05-25
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping("/api/front/book")
|
|
|
|
|
|
+//@RequestMapping("/api/front/book")
|
|
public class BookInfoController {
|
|
public class BookInfoController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IBookInfoService bookInfoService;
|
|
private IBookInfoService bookInfoService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IBookChapterService bookChapterService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IBookContentService bookContentService;
|
|
|
|
-
|
|
|
|
// http://localhost:8888/api/front/book/list
|
|
// http://localhost:8888/api/front/book/list
|
|
- @GetMapping("/list")
|
|
|
|
|
|
+ @GetMapping("/api/front/book/list")
|
|
public List<BookInfo> list(){
|
|
public List<BookInfo> list(){
|
|
// 不需要编写sql语句 直接进行增删改查操作
|
|
// 不需要编写sql语句 直接进行增删改查操作
|
|
return bookInfoService.list();
|
|
return bookInfoService.list();
|
|
}
|
|
}
|
|
|
|
|
|
// http://127.0.0.1:8888/api/front/book/{id}
|
|
// http://127.0.0.1:8888/api/front/book/{id}
|
|
- @GetMapping("/{id}")
|
|
|
|
|
|
+ @GetMapping("/api/front/book/{id}")
|
|
public RestResp<BookInfoRespDto> getBookInfoById(@PathVariable Long id){
|
|
public RestResp<BookInfoRespDto> getBookInfoById(@PathVariable Long id){
|
|
// getById是mybatis plus提供的方法
|
|
// getById是mybatis plus提供的方法
|
|
// 从对应表中 where id = '' 中的数据取出
|
|
// 从对应表中 where id = '' 中的数据取出
|
|
@@ -61,20 +55,4 @@ public class BookInfoController {
|
|
BeanUtils.copyProperties(bookInfo,bookInfoRespDto);
|
|
BeanUtils.copyProperties(bookInfo,bookInfoRespDto);
|
|
return RestResp.ok(bookInfoRespDto);
|
|
return RestResp.ok(bookInfoRespDto);
|
|
}
|
|
}
|
|
-
|
|
|
|
- // http://127.0.0.1:8888/api/front/book/chapter/list?bookId=1337872597996539904
|
|
|
|
- @GetMapping("/chapter/list")
|
|
|
|
- public RestResp<List<BookChapterRespDto>> listChapters(@RequestParam("bookId") Long bookId){
|
|
|
|
- // 根据传进来的参数 bookId 去查询对应书籍的章节信息
|
|
|
|
- List<BookChapterRespDto> chapterRespDtos = bookChapterService.getBookChapterByBookId(bookId);
|
|
|
|
- return RestResp.ok(chapterRespDtos);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // http://127.0.0.1:8888/api/front/book/content/{chapterId}
|
|
|
|
- @GetMapping("/content/{chapterId}")
|
|
|
|
- public RestResp<BookContentAboutRespDto> getBookContentAbout(
|
|
|
|
- @PathVariable("chapterId") Long chapterId) {
|
|
|
|
- BookContentAboutRespDto bookContentAbout = bookContentService.getBookContentAbout(chapterId);
|
|
|
|
- return RestResp.ok(bookContentAbout);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|