|
18 | 18 | import com.book.backend.utils.RandomNameUtils;
|
19 | 19 | import org.springframework.beans.BeanUtils;
|
20 | 20 | import org.springframework.beans.factory.annotation.Autowired;
|
| 21 | +import org.springframework.transaction.annotation.Transactional; |
21 | 22 | import org.springframework.util.DigestUtils;
|
22 | 23 | import org.springframework.web.bind.annotation.*;
|
23 | 24 |
|
@@ -113,6 +114,7 @@ public R<List<BookType>> getBookTypeList() {
|
113 | 114 | * @return R
|
114 | 115 | */
|
115 | 116 | @PostMapping("add_book")
|
| 117 | + @Transactional |
116 | 118 | public R addBook(@RequestBody BookDTO bookDTO) {
|
117 | 119 | /**
|
118 | 120 | * 1.获取图书名称,图书作者,图书馆名称,书籍类别的id,书籍位置,书籍状态,书籍介绍
|
@@ -154,6 +156,7 @@ public R addBook(@RequestBody BookDTO bookDTO) {
|
154 | 156 | * @return R
|
155 | 157 | */
|
156 | 158 | @GetMapping("delete_book/{bookId}")
|
| 159 | + @Transactional |
157 | 160 | public R deleteBookByBookId(@PathVariable("bookId") Integer bookId) {
|
158 | 161 | /**
|
159 | 162 | * 1.先根据图书id查询是否有这本图书,如果图书不存在直接返回
|
@@ -333,6 +336,7 @@ public R updateBookType(@RequestBody BookType bookType) {
|
333 | 336 | * @return R
|
334 | 337 | */
|
335 | 338 | @GetMapping("delete_booktype/{typeId}")
|
| 339 | + @Transactional |
336 | 340 | public R deleteBookTypeByTypeId(@PathVariable("typeId") Integer typeId) {
|
337 | 341 | /**
|
338 | 342 | * 1.先根据typeId查询是否有此书籍类别
|
@@ -520,6 +524,7 @@ public R updateStatement(@RequestBody UsersDTO usersDTO) {
|
520 | 524 | * @return R
|
521 | 525 | */
|
522 | 526 | @DeleteMapping("delete_statement/{userId}")
|
| 527 | + @Transactional |
523 | 528 | public R deleteStatementByUserId(@PathVariable("userId") Integer userId) {
|
524 | 529 | /**
|
525 | 530 | * 1.根据userId查询是否有该用户
|
@@ -641,6 +646,7 @@ public R<BookRuleDTO> getRuleByRuleId(@PathVariable("ruleId") Integer ruleId) {
|
641 | 646 | * @return R
|
642 | 647 | */
|
643 | 648 | @PutMapping("update_rule")
|
| 649 | + @Transactional |
644 | 650 | public R updateRule(@RequestBody BookRuleDTO bookRuleDTO){
|
645 | 651 | /**
|
646 | 652 | * 1.接受限制的图书馆数组,将数组变为字符串
|
@@ -669,6 +675,7 @@ public R updateRule(@RequestBody BookRuleDTO bookRuleDTO){
|
669 | 675 | * @return R
|
670 | 676 | */
|
671 | 677 | @DeleteMapping("delete_rule/{ruleId}")
|
| 678 | + @Transactional |
672 | 679 | public R deleteRule(@PathVariable("ruleId") Integer ruleId){
|
673 | 680 | /**
|
674 | 681 | * 1.根据规则id查询是否有该规则
|
|
0 commit comments