コード例 #1
0
 @RequestMapping(value = "/search", method = GET, headers = ACCEPT_JSON)
 public ResponseEntity<OpenLmisResponse> getByProgram(
     @RequestParam(value = "page", defaultValue = "1") Integer page,
     @RequestParam(value = "searchParam", required = true) String searchParam,
     @RequestParam(value = "column", required = true, defaultValue = "product") String column,
     @Value("${search.page.size}") String limit) {
   Pagination pagination = new Pagination(page, parseInt(limit));
   pagination.setTotalRecords(service.getTotalSearchResultCount(searchParam, column));
   List<ProgramProduct> programProductList = service.search(searchParam, pagination, column);
   ResponseEntity<OpenLmisResponse> response =
       OpenLmisResponse.response(PROGRAM_PRODUCT_LIST, programProductList);
   response.getBody().addData("pagination", pagination);
   return response;
 }
コード例 #2
0
 @RequestMapping(value = "list", method = RequestMethod.GET)
 public ResponseEntity<OpenLmisResponse> getInventory(
     @RequestParam("typeId") Long typeId,
     @RequestParam("programId") Long programId,
     @RequestParam("equipmentTypeId") Long equipmentTypeId,
     @RequestParam(value = "page", defaultValue = "1") Integer page,
     @Value("${search.page.size}") String limit,
     HttpServletRequest request) {
   Long userId = loggedInUserId(request);
   Pagination pagination = new Pagination(page, parseInt(limit));
   pagination.setTotalRecords(
       service.getInventoryCount(userId, typeId, programId, equipmentTypeId));
   List<EquipmentInventory> inventory =
       service.getInventory(userId, typeId, programId, equipmentTypeId, pagination);
   ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.response(INVENTORY, inventory);
   response.getBody().addData(PAGINATION, pagination);
   return response;
 }