Пример #1
0
 @RequestMapping(method = RequestMethod.GET)
 @ResponseBody
 public String page(@RequestParam(required = false) String q, PageParam pageParam) {
   List<SearchFilter> filters =
       StringUtils.isEmpty(q) ? new ArrayList<SearchFilter>() : SearchFilter.parseQuery(q);
   filters.add(new SearchFilter("creator.id", Operator.EQ, currentUserId()));
   filters.add(new SearchFilter("status", Operator.EQ, Share.Status.CREATED));
   Page<Share> page = shareService2.findAll(filters, pageParam.getPageable(Share.class));
   return Gsons.filterByFields(ShareDto.Brief.class, pageParam.getFields())
       .toJson(PageDto.of(page, ShareDto.toBrief));
 }
Пример #2
0
 /**
  * 搜索我搜到的分享
  *
  * @param q
  * @param pageParam
  * @return
  */
 @RequestMapping(value = "/received", method = RequestMethod.GET)
 @ResponseBody
 public String pageReceived(@RequestParam(required = false) String q, PageParam pageParam) {
   List<SearchFilter> filters =
       StringUtils.isEmpty(q) ? new ArrayList<SearchFilter>() : SearchFilter.parseQuery(q);
   filters.add(new SearchFilter("recipient.id", Operator.EQ, currentUserId()));
   filters.add(new SearchFilter("isDeleted", Operator.EQ, Boolean.FALSE));
   filters.add(new SearchFilter("share.status", Operator.NE, Share.Status.CANCELED));
   Page<ReceivedShare> page =
       receivedShareService.findAll(filters, pageParam.getPageable(ReceivedShare.class));
   return Gsons.filterByFields(ReceivedShareDto.Brief.class, pageParam.getFields())
       .toJson(PageDto.of(page, ReceivedShareDto.toBrief));
 }