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;