From 94682e011ace6eba0d61dea8c98cf112ba0629f6 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Wed, 4 Dec 2024 18:00:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/book/controller/BookController.java | 15 ++++++++------- .../book/service/impl/BookServiceImpl.java | 5 ++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/BookController.java b/src/main/java/com/peanut/modules/book/controller/BookController.java index 705d5dd1..741f537d 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookController.java @@ -348,13 +348,14 @@ public class BookController { @RequestMapping("/getChapter") @Transactional public R getChapter(@RequestParam("id") Integer id) { - - bookService.getWordSection(id); - BookEntity bookEntity = bookService.getBaseMapper().selectById(id); - bookEntity.setChapterStatus("2"); - bookService.updateById(bookEntity); - - return R.ok(); + if (bookService.getWordSection(id)){ + BookEntity bookEntity = bookService.getBaseMapper().selectById(id); + bookEntity.setChapterStatus("2"); + bookService.updateById(bookEntity); + return R.ok(); + }else { + return R.error(); + } } diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java index b4ee7e14..46872cb0 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java @@ -457,7 +457,6 @@ public class BookServiceImpl extends ServiceImpl implements try{ bookChapterService.remove(new LambdaQueryWrapper().eq(BookChapterEntity::getBookId,bookId)); bookChapterContentService.remove(new LambdaQueryWrapper().eq(BookChapterContentEntity::getBookId,bookId)); - int topText = 22; int secText = 16; BookEntity bookEntity = this.getBaseMapper().selectById(bookId); @@ -539,13 +538,13 @@ public class BookServiceImpl extends ServiceImpl implements } } } - throw new NullPointerException(); + return true; }catch (Exception e) { e.printStackTrace(); //事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return false; } - return false; } public String uploadFile(InputStream inputStream,String fileName) { String endpoint = ConstantPropertiesUtils.END_POIND;