Пример #1
0
 @RequestMapping(
     value = "/editLoan",
     method = {RequestMethod.GET, RequestMethod.POST},
     consumes = "application/json")
 public List<Loan> editLoan(@RequestBody List<Loan> loans) {
   for (Loan loan : loans) ldao.updateLoan(loan);
   return ldao.getAllLoans(1, 5);
 }
Пример #2
0
 @RequestMapping(
     value = "/checkin",
     method = {RequestMethod.GET, RequestMethod.POST},
     consumes = "application/json")
 public void checkin(@RequestBody Loan loan) {
   ldao.checkin(loan);
 }
Пример #3
0
 /*Admin Loan*/
 @RequestMapping(
     value = "/getLoans/{pageNo}/{pageSize}",
     method = {RequestMethod.GET, RequestMethod.POST},
     produces = "application/json")
 public List<Loan> getLoans(@PathVariable int pageNo, @PathVariable int pageSize) {
   return ldao.getAllLoans(pageNo, pageSize);
 }
Пример #4
0
 @RequestMapping(
     value = "/getBranchesByCardNo/{cardNo}",
     method = {RequestMethod.GET, RequestMethod.POST},
     produces = "application/json")
 public List<Branch> getBranchesByCardNo(@PathVariable int cardNo) {
   List<Loan> loans = ldao.getLoansByCardNo(cardNo);
   List<Branch> branches = new ArrayList<>();
   for (Loan l : loans) if (!branches.contains(l.getBranch())) branches.add(l.getBranch());
   return branches;
 }
Пример #5
0
 @RequestMapping(
     value = "/getBooksByCardNoAndBranchId/{cardNo}/{branchId}",
     method = {RequestMethod.GET, RequestMethod.POST},
     produces = "application/json")
 public List<Book> getBooksByCardNoAndBranchId(
     @PathVariable int cardNo, @PathVariable int branchId) {
   List<Loan> loans = ldao.getLoansByCardNoAndBranchId(cardNo, branchId, -1, 5);
   List<Book> books = new ArrayList<>();
   for (Loan l : loans) if (!books.contains(l.getBook())) books.add(l.getBook());
   return books;
 }