use of com.tony.billing.request.BaseRequest in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method listTag.
/**
* 列出所有标签
*
* @param request
* @return
*/
@RequestMapping(value = "/tag/list")
public TagInfoListResponse listTag(@ModelAttribute("request") BaseRequest request) {
TagInfoListResponse response = new TagInfoListResponse();
TagInfo tagInfo = new TagInfo();
tagInfo.setUserId(request.getUserId());
List<TagInfo> tagInfos = tagInfoService.listTagInfo(tagInfo);
if (!CollectionUtils.isEmpty(tagInfos)) {
response.setTagInfoList(tagInfos.parallelStream().map(tag -> {
TagInfoDTO model = new TagInfoDTO();
model.setTagName(tag.getTagName());
model.setTagId(tag.getId());
model.setUsageCount(tagInfoService.countTagUsage(tag.getId(), request.getUserId()));
return model;
}).sorted(Comparator.comparing(TagInfoDTO::getUsageCount).reversed()).collect(Collectors.toList()));
}
ResponseUtil.success(response);
return response;
}
Aggregations