Exemplo n.º 1
0
  @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");
  }
Exemplo n.º 2
0
 @RequestMapping("/markRead")
 @ResponseBody
 public String markRead(@RequestParam("id") Long id) {
   notificationDataService.markRead(id);
   return "";
 }