修改事务
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -457,7 +457,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
try{
|
||||
bookChapterService.remove(new LambdaQueryWrapper<BookChapterEntity>().eq(BookChapterEntity::getBookId,bookId));
|
||||
bookChapterContentService.remove(new LambdaQueryWrapper<BookChapterContentEntity>().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<BookDao, BookEntity> 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;
|
||||
|
||||
Reference in New Issue
Block a user