@RequestMapping @PageableDefaults(value = 20, sort = "id=desc") public String list(@CurrentUser User user, Pageable pageable, Model model) { Searchable searchable = Searchable.newSearchable(); searchable.addSearchFilter("userId", SearchOperator.eq, user.getId()); Page<NotificationData> page = notificationDataService.findAll(pageable); model.addAttribute("page", page); if (pageable.getPageNumber() == 0) { notificationDataService.markReadAll(user.getId()); } return viewName("list"); }
@RequestMapping("/markRead") @ResponseBody public String markRead(@RequestParam("id") Long id) { notificationDataService.markRead(id); return ""; }