public PaginationRsp<NodeGroupPo> getNodeGroup(NodeGroupGetReq request) {
        PaginationRsp<NodeGroupPo> response = new PaginationRsp<NodeGroupPo>();

        Long results = new SelectSql(getSqlTemplate())
                .select()
                .columns("count(1)")
                .from()
                .table(getTableName())
                .whereSql(
                        new WhereSql()
                        .andOnNotNull("node_type = ?", request.getNodeType() == null ? null : request.getNodeType().name())
                        .andOnNotEmpty("name = ?", request.getNodeGroup())
                )
                .single();
        response.setResults(results.intValue());
        if (results == 0) {
            return response;
        }

        List<NodeGroupPo> rows = new SelectSql(getSqlTemplate())
                .select()
                .all()
                .from()
                .table(getTableName())
                .whereSql(
                        new WhereSql()
                        .andOnNotNull("node_type = ?", request.getNodeType() == null ? null : request.getNodeType().name())
                        .andOnNotEmpty("name = ?", request.getNodeGroup())
                )
                .orderBy()
                .column("gmt_created", OrderByType.DESC)
                .limit(request.getStart(), request.getLimit())
                .list(RshHolder.NODE_GROUP_LIST_RSH);

        response.setRows(rows);

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