@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); }
@RequestMapping( value = "/checkin", method = {RequestMethod.GET, RequestMethod.POST}, consumes = "application/json") public void checkin(@RequestBody Loan loan) { ldao.checkin(loan); }
/*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); }
@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; }
@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; }