@Override
    public PaginationRsp<NodeGroupPo> getNodeGroup(NodeGroupGetReq request) {
        Query<NodeGroupPo> query = template.createQuery(NodeGroupPo.class);
        if (request.getNodeType() != null) {
            query.field("nodeType").equal(request.getNodeType());
        }
        if (StringUtils.isNotEmpty(request.getNodeGroup())) {
            query.field("name").equal(request.getNodeGroup());
        }
        PaginationRsp<NodeGroupPo> response = new PaginationRsp<NodeGroupPo>();
        Long results = template.getCount(query);
        response.setResults(results.intValue());
        if (results == 0) {
            return response;
        }
        query.order("-gmtCreated").offset(request.getStart()).limit(request.getLimit());

        response.setRows(query.asList());
        return response;
    }
@author Robert HG (254963746@qq.com) on 6/7/15.
lts-core/src/main/java/com/github/ltsopensource/queue/mongo/MongoNodeGroupStore.java