基于springboot的图书进销存管理系统 毕业设计 springboot+Vue+mysql
该系统的核心功能包括图书信息的管理、进货管理、销售管理、库存管理以及基础数据管理等。以下是部分核心代码示例:
图书信息管理Controller层:
@RestController
@RequestMapping("/books")
public class BookController {
@Autowired
private BookService bookService;
@GetMapping("/list")
public List<Book> getBookList() {
return bookService.findAll();
}
@PostMapping("/add")
public ResponseEntity<Book> addBook(@RequestBody Book book) {
return ResponseEntity.ok(bookService.save(book));
}
@PutMapping("/update")
public ResponseEntity<Book> updateBook(@RequestBody Book book) {
return ResponseEntity.ok(bookService.update(book));
}
@DeleteMapping("/delete/{id}")
public ResponseEntity<Void> deleteBook(@PathVariable Long id) {
bookService.deleteById(id);
return ResponseEntity.noContent().build();
}
}
图书信息管理Service层:
@Service
public class BookService {
@Autowired
private BookRepository bookRepository;
public List<Book> findAll() {
return bookRepository.findAll();
}
public Book save(Book book) {
return bookRepository.save(book);
}
public Book update(Book book) {
return bookRepository.save(book);
}
public void deleteById(Long id) {
bookRepository.deleteById(id);
}
}
进货管理Controller层:
@RestController
@RequestMapping("/purchases")
public class PurchaseController {
@Autowired
private PurchaseService purchaseService;
@PostMapping("/add")
public ResponseEntity<Purchase> addPurchase(@RequestBody Purchase purchase) {
return ResponseEntity.ok(purchaseService.addPurchase(purchase));
}
@GetMapping("/list")
public List<Purchase> getPurchaseList() {
return purchaseService.findAll();
}
}
进货管理Service层:
@Service
public class PurchaseService {
@Autowired
private PurchaseRepository purchaseRepository;
public Purchase addPurchase(Purchase purchase) {
return
评论已关闭