From f10ffa664e71f958d77ace9ced96c990e291c58b Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Sat, 10 Oct 2026 19:45:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(novel-front):=20=E4=BD=9C=E5=AE=B6?= =?UTF-8?q?=E4=B8=93=E5=8C=BA=E5=A2=9E=E5=8A=A0=E4=BD=9C=E5=93=81=E5=AE=8C?= =?UTF-8?q?=E7=BB=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../novel/controller/AuthorController.java | 13 ++++ .../java2nb/novel/service/BookService.java | 5 ++ .../novel/service/impl/BookServiceImpl.java | 15 +++- .../resources/templates/author/index.html | 75 +++++++++++++++---- 4 files changed, 93 insertions(+), 15 deletions(-) diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/AuthorController.java b/novel-front/src/main/java/com/java2nb/novel/controller/AuthorController.java index eacaca6..912cfa9 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/AuthorController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/AuthorController.java @@ -95,6 +95,19 @@ public class AuthorController extends BaseController { return RestResult.ok(); } + /** + * 完结小说 + */ + @PostMapping("finishBook") + public RestResult finishBook(Long bookId, HttpServletRequest request) { + Author author = checkAuthor(request); + + //完结小说 + bookService.finishBook(bookId, author.getId()); + + return RestResult.ok(); + } + /** * 删除章节 diff --git a/novel-front/src/main/java/com/java2nb/novel/service/BookService.java b/novel-front/src/main/java/com/java2nb/novel/service/BookService.java index b150092..54626fb 100644 --- a/novel-front/src/main/java/com/java2nb/novel/service/BookService.java +++ b/novel-front/src/main/java/com/java2nb/novel/service/BookService.java @@ -304,4 +304,9 @@ public interface BookService { PageBean listCommentReplyByPage(Long userId, Long commentId, int page, int pageSize); BookComment getBookComment(Long commentId); + + /** + * 完结小说 + * */ + void finishBook(Long bookId, Long authorId); } diff --git a/novel-front/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java b/novel-front/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java index ab917e4..542be26 100644 --- a/novel-front/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java +++ b/novel-front/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java @@ -507,7 +507,7 @@ public class BookServiceImpl implements BookService { PageHelper.startPage(page, pageSize); SelectStatementProvider selectStatement = select(id, bookName, picUrl, catName, visitCount, yesterdayBuy, - lastIndexUpdateTime, updateTime, wordCount, lastIndexName, status) + lastIndexUpdateTime, updateTime, wordCount, lastIndexName, bookStatus, status) .from(book) .where(authorId, isEqualTo(author.getId())) .orderBy(BookDynamicSqlSupport.createTime.descending()) @@ -919,5 +919,18 @@ public class BookServiceImpl implements BookService { return bookCommentMapper.selectByPrimaryKey(commentId).orElse(null); } + @Override + public void finishBook(Long bookId, Long authorId) { + bookMapper.update(update(book) + .set(bookStatus) + .equalTo((byte) 1) + .set(updateTime) + .equalTo(new Date()) + .where(id, isEqualTo(bookId)) + .and(BookDynamicSqlSupport.authorId, isEqualTo(authorId)) + .build() + .render(RenderingStrategies.MYBATIS3)); + } + } \ No newline at end of file diff --git a/novel-front/src/main/resources/templates/author/index.html b/novel-front/src/main/resources/templates/author/index.html index 00a6c63..2c1034f 100644 --- a/novel-front/src/main/resources/templates/author/index.html +++ b/novel-front/src/main/resources/templates/author/index.html @@ -21,6 +21,10 @@ color: #fff; } + + th.name, td.name { + text-align: center; + } @@ -51,7 +55,8 @@