use of com.topcom.cms.domain.Group in project topcom-cloud by 545314690.
the class GroupManagerImpl method findGroupById.
@Override
@Cacheable(value = "groupCache", key = "#id + 'getGroupListById'")
public // 将缓存保存进groupCache,并使用参数中的id加上一个字符串(这里使用方法名称)作为缓存的key
Group findGroupById(Long id) {
Group g = groupDao.findTreeGroupById(id);
findAllChildren(g);
return g;
}
use of com.topcom.cms.domain.Group in project topcom-cloud by 545314690.
the class SearchWordController method findByType.
/**
* 热词查询 查询排名前 limit 的word
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/findByType", produces = "application/json")
@ResponseBody
public List<SearchWord> findByType(@CurrentUser User user, @ApiParam("limit") @RequestParam(required = true) Integer limit, @ApiParam("type") @RequestParam(required = true) Integer type) {
Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "wordCount"));
Pageable page = new PageRequest(0, limit, sort);
User user1 = this.userManager.findById(user.getId());
Set<Group> groups = user1.getGroups();
String groupId = SearchWord.groupIdBySet(groups);
List<String> groupIdList = new ArrayList<>();
groupIdList.add(groupId);
if (groupId.indexOf(",") != -1) {
String[] split = groupId.split(",");
for (String s : split) {
groupIdList.add(s);
}
}
Page<SearchWord> searchWords = this.searchWordManager.findByTypeAndGroupIdIn(page, type, groupIdList);
return filterNull(searchWords);
}
use of com.topcom.cms.domain.Group in project topcom-cloud by 545314690.
the class GroupManagerImpl method findAllChildren.
private void findAllChildren(Group g) {
List<Group> list = groupDao.findChildrenByParentId(g.getId());
if (list != null && list.size() != 0) {
g.setChildren(list);
g.setLeaf(false);
}
for (Group group : list) {
findAllChildren(group);
}
}
use of com.topcom.cms.domain.Group in project topcom-cloud by 545314690.
the class SearchWordController method addClickCount.
/**
* 增加点击次数 对于单个搜索词 可以支持累加
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/add", produces = "application/json")
@ResponseBody
public SearchWord addClickCount(@CurrentUser User user, @ApiParam("Word") @RequestParam(required = true) String word, @ApiParam("type") @RequestParam(required = true) Integer type) {
User user1 = this.userManager.findById(user.getId());
Set<Group> groups = user1.getGroups();
return searchWordManager.addClickCount(groups, word, type);
}
use of com.topcom.cms.domain.Group in project topcom-cloud by 545314690.
the class SearchWordController method findByWord.
@RequestMapping(method = RequestMethod.GET, value = "/findByWord", produces = "application/json")
@ResponseBody
public List<SearchWord> findByWord(@CurrentUser User user, @ApiParam("limit") @RequestParam(required = true) Integer limit, @ApiParam("word") @RequestParam(required = true) String word) {
Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "wordCount"));
Pageable page = new PageRequest(0, limit, sort);
User user1 = this.userManager.findById(user.getId());
Set<Group> groups = user1.getGroups();
String groupId = SearchWord.groupIdBySet(groups);
List<String> groupIdList = new ArrayList<>();
groupIdList.add(groupId);
if (groupId.indexOf(",") != -1) {
String[] split = groupId.split(",");
for (String s : split) {
groupIdList.add(s);
}
}
Page<SearchWord> searchWords = this.searchWordManager.findByWordAndGroupIdIn(page, word, groupIdList);
return filterNull(searchWords);
}
Aggregations