|
@@ -2,7 +2,9 @@ package com.sf.springboot.controller;
|
|
|
|
|
|
import com.sf.springboot.dto.Result;
|
|
import com.sf.springboot.dto.Result;
|
|
import com.sf.springboot.entity.Book;
|
|
import com.sf.springboot.entity.Book;
|
|
|
|
+import com.sf.springboot.service.BookService;
|
|
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
|
|
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -38,7 +40,8 @@ public class BookController {
|
|
* 添加图书
|
|
* 添加图书
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @RequestMapping("/addBook2")
|
|
|
|
|
|
+// @RequestMapping(value = "/addBook2",method = RequestMethod.POST)
|
|
|
|
+ @PostMapping("/addBook2")
|
|
public Result addBook2(@RequestBody Book book){
|
|
public Result addBook2(@RequestBody Book book){
|
|
System.out.println(book);
|
|
System.out.println(book);
|
|
return new Result();
|
|
return new Result();
|
|
@@ -59,7 +62,8 @@ public class BookController {
|
|
* 更新图书
|
|
* 更新图书
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @RequestMapping("/updateBook2")
|
|
|
|
|
|
+// @RequestMapping(value = "/updateBook2",method = RequestMethod.PUT)
|
|
|
|
+ @PutMapping("/updateBook2")
|
|
public Result updateBook2(@RequestBody Book book){
|
|
public Result updateBook2(@RequestBody Book book){
|
|
System.out.println(book);
|
|
System.out.println(book);
|
|
return new Result();
|
|
return new Result();
|
|
@@ -71,7 +75,8 @@ public class BookController {
|
|
* @param bookId
|
|
* @param bookId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @RequestMapping("/deleteBook")
|
|
|
|
|
|
+// @RequestMapping(value = "/deleteBook",method = RequestMethod.DELETE)
|
|
|
|
+ @DeleteMapping("/deleteBook")
|
|
public Result deleteBook(Integer bookId){
|
|
public Result deleteBook(Integer bookId){
|
|
System.out.println(bookId);
|
|
System.out.println(bookId);
|
|
return new Result();
|
|
return new Result();
|
|
@@ -98,7 +103,8 @@ public class BookController {
|
|
* 根据图书的id去查询图书的详情
|
|
* 根据图书的id去查询图书的详情
|
|
*/
|
|
*/
|
|
|
|
|
|
- @RequestMapping("/getBookInfo")
|
|
|
|
|
|
+// @RequestMapping(value = "/getBookInfo",method = RequestMethod.GET)
|
|
|
|
+ @GetMapping("/getBookInfo")
|
|
public Result getBookInfo(Integer bookId){
|
|
public Result getBookInfo(Integer bookId){
|
|
System.out.println(bookId);
|
|
System.out.println(bookId);
|
|
return new Result();
|
|
return new Result();
|
|
@@ -167,4 +173,14 @@ public class BookController {
|
|
ResponseEntity<byte[]> response = new ResponseEntity<>(body,headers,ok);
|
|
ResponseEntity<byte[]> response = new ResponseEntity<>(body,headers,ok);
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private BookService bookService;
|
|
|
|
+
|
|
|
|
+ @PostMapping("/addBook66")
|
|
|
|
+ public Result addBook66(@RequestBody Book book){
|
|
|
|
+ bookService.addBook(book);
|
|
|
|
+ return new Result();
|
|
|
|
+ }
|
|
|
|
+ }
|