Search in sources :

Example 1 with AggPageImpl

use of com.topcom.cms.es.vo.AggPageImpl in project topcom-cloud by 545314690.

the class UserStyleController method findAllGroupAndUsersyle.

@ApiOperation("查询group列表")
@RequestMapping(value = { "findAllGroupAndUsersyle" }, method = { RequestMethod.POST }, produces = { "application/json" }, consumes = { "application/json" })
@ResponseBody
public Page findAllGroupAndUsersyle(@RequestBody PageRequest page) {
    Page<Group> groupPage = groupManager.findAll(page.pageable());
    List<GroupStyle> contentList = new ArrayList<>();
    for (Group group : groupPage.getContent()) {
        Long groupId = group.getId();
        UserStyle userStyle = this.userStyleManager.findByGroupId(groupId);
        GroupStyle groupStyle;
        if (userStyle != null) {
            groupStyle = new GroupStyle(group, userStyle);
        } else {
            groupStyle = new GroupStyle(group);
        }
        contentList.add(groupStyle);
    }
    Page result = new AggPageImpl<>(contentList, groupPage.getTotalPages(), groupPage.getTotalElements(), page.pageable());
    return result;
}
Also used : UserStyle(com.topcom.cms.yuqing.domain.UserStyle) Group(com.topcom.cms.domain.Group) AggPageImpl(com.topcom.cms.es.vo.AggPageImpl) GroupStyle(com.topcom.cms.yuqing.vo.request.GroupStyle) ArrayList(java.util.ArrayList) Page(org.springframework.data.domain.Page) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Group (com.topcom.cms.domain.Group)1 AggPageImpl (com.topcom.cms.es.vo.AggPageImpl)1 UserStyle (com.topcom.cms.yuqing.domain.UserStyle)1 GroupStyle (com.topcom.cms.yuqing.vo.request.GroupStyle)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 Page (org.springframework.data.domain.Page)1