@RequestMapping("addBookborrow")
public String addBookborrow(ModelMap model, Bookborrow bo
okborrow,HttpServletRequest request, Bookcard bookcard,
HttpSession session,Books books)
int i = bookBorrowService.findBbCount(bookborrow);
int j = bookcardService.findts(bookcard1);
System.out.println("----------------------" + i);
books = booksService.findBookById(books);
System.out.println("---------图书剩余数量===" + books.getBookNum());
if (j == 0) {
model.put("error", "您还没有借书卡,请先申请借书卡才能借书!");
System.out.println("未申请借书卡");
return "boraddBookborrowrowerror";
}
if (j > 0) {
if (bookcard1.getBcState() == 0) {
model.put("error", "借书卡未激活,请联系管理员激活!");
System.out.println("借书卡未激活,请联系管理员激活!");
return "borrowerror";
}else if (books.getBookNum() == 0) {
model.put("error", "图书全被别人借走啦!下次早点来!");
System.out.println("图书全被别人借走啦!下次早点来!");
return "borrowerror";
} else if (user.getUserMoney() < 1) {
model.put("error", "您好,您的账户余额不足,请先充值!");
System.out.println("您好,您的账户余额不足,请先充值!");
return "borrowerror";
}
else if (i >= 5) {
System.out.println("每个人同时只能借 5 本书,请先归还!");
model.put("error", "每个人同时只能借 5 本书,请先归还!");
return "borrowerror";
} else {
System.out
.println("条件全部符合,添加成功!");