Skip to content

Commit f62e69b

Browse files
committed
修复Bug 11位图书编号无法借书 添加Knife4J调试地址提醒
1 parent ec07be2 commit f62e69b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/main/java/com/book/backend/controller/admin/AdminFunctionController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.book.backend.utils.RandomNameUtils;
1919
import org.springframework.beans.BeanUtils;
2020
import org.springframework.beans.factory.annotation.Autowired;
21+
import org.springframework.transaction.annotation.Transactional;
2122
import org.springframework.util.DigestUtils;
2223
import org.springframework.web.bind.annotation.*;
2324

@@ -113,6 +114,7 @@ public R<List<BookType>> getBookTypeList() {
113114
* @return R
114115
*/
115116
@PostMapping("add_book")
117+
@Transactional
116118
public R addBook(@RequestBody BookDTO bookDTO) {
117119
/**
118120
* 1.获取图书名称,图书作者,图书馆名称,书籍类别的id,书籍位置,书籍状态,书籍介绍
@@ -154,6 +156,7 @@ public R addBook(@RequestBody BookDTO bookDTO) {
154156
* @return R
155157
*/
156158
@GetMapping("delete_book/{bookId}")
159+
@Transactional
157160
public R deleteBookByBookId(@PathVariable("bookId") Integer bookId) {
158161
/**
159162
* 1.先根据图书id查询是否有这本图书,如果图书不存在直接返回
@@ -333,6 +336,7 @@ public R updateBookType(@RequestBody BookType bookType) {
333336
* @return R
334337
*/
335338
@GetMapping("delete_booktype/{typeId}")
339+
@Transactional
336340
public R deleteBookTypeByTypeId(@PathVariable("typeId") Integer typeId) {
337341
/**
338342
* 1.先根据typeId查询是否有此书籍类别
@@ -520,6 +524,7 @@ public R updateStatement(@RequestBody UsersDTO usersDTO) {
520524
* @return R
521525
*/
522526
@DeleteMapping("delete_statement/{userId}")
527+
@Transactional
523528
public R deleteStatementByUserId(@PathVariable("userId") Integer userId) {
524529
/**
525530
* 1.根据userId查询是否有该用户
@@ -641,6 +646,7 @@ public R<BookRuleDTO> getRuleByRuleId(@PathVariable("ruleId") Integer ruleId) {
641646
* @return R
642647
*/
643648
@PutMapping("update_rule")
649+
@Transactional
644650
public R updateRule(@RequestBody BookRuleDTO bookRuleDTO){
645651
/**
646652
* 1.接受限制的图书馆数组,将数组变为字符串
@@ -669,6 +675,7 @@ public R updateRule(@RequestBody BookRuleDTO bookRuleDTO){
669675
* @return R
670676
*/
671677
@DeleteMapping("delete_rule/{ruleId}")
678+
@Transactional
672679
public R deleteRule(@PathVariable("ruleId") Integer ruleId){
673680
/**
674681
* 1.根据规则id查询是否有该规则

src/main/java/com/book/backend/controller/bookadmin/BookAdminFunctionController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.book.backend.utils.JwtKit;
1818
import org.springframework.beans.BeanUtils;
1919
import org.springframework.beans.factory.annotation.Autowired;
20+
import org.springframework.transaction.annotation.Transactional;
2021
import org.springframework.web.bind.annotation.*;
2122

2223
import java.time.Duration;
@@ -55,6 +56,7 @@ public class BookAdminFunctionController {
5556
* @return R
5657
*/
5758
@PostMapping("borrow_book")
59+
@Transactional
5860
public R borrowBookByCardNumberAndBookNumber(@RequestBody BooksBorrowDTO booksBorrowDTO) {
5961
/**
6062
* 1.接受前端请求中的参数(借阅证号、图书编号、借阅时间)
@@ -205,6 +207,7 @@ public R<ViolationDTO> queryExpireInformationByBookNumber(@PathVariable("bookNum
205207
* @return R
206208
*/
207209
@PostMapping("return_book")
210+
@Transactional
208211
public R returnBook(@RequestBody Violation violation) {
209212
/**
210213
* 1.获取归还日期和违章信息和图书编号

src/main/resources/banner.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ by 程序员小白条
22
GitEE: https://gitee.com/falle22222n-leaves
33
GitHub: https://github.com/luoye6
44
个人博客: https://luoye6.github.io/
5+
Knife4j后端接口在线调试地址: http://localhost:8889/api/doc.html

0 commit comments

Comments
 (0)