Пример #1
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;
 }
Пример #2
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;
 }