goja-core/src/main/java/goja/core/db/Dao.java
public static Page<Record> paginate(String sqlPaginatePrefix,
                                        PageDto pageDto) {
        SqlNode sqlNode = SqlKit.sqlNode(sqlPaginatePrefix + ".paginate");
        Preconditions.checkNotNull(sqlNode, "[" + sqlPaginatePrefix + ".paginate]分页Sql不存在,无法执行分页");
        String where = sqlNode.whereSql;
        int pageSize = pageDto.pageSize;
        int p = pageDto.page;
        int start = ((p - 1) * pageSize) + 1;
        final List<RequestParam> params = pageDto.params;
        final List<Object> query_params = pageDto.query_params;
        if ((params.isEmpty()) && (query_params.isEmpty())) {
            return Db.paginate(start, pageSize, sqlNode.selectSql, where);
        } else {

            if (!params.isEmpty()) {
                where += (sqlNode.condition ? StringPool.SPACE : " WHERE 1=1 ");
            }
            for (RequestParam param : pageDto.params) {
                where += param.toSql();
            }
            return Db.paginate(start, pageSize, sqlNode.selectSql, where, query_params.toArray());
        }
    }
public static Page<Record> paginate(String sqlPaginatePrefix,
                                        PageDto pageDto) {
        SqlNode sqlNode = SqlKit.sqlNode(sqlPaginatePrefix + ".paginate");
        Preconditions.checkNotNull(sqlNode, "[" + sqlPaginatePrefix + ".paginate]分页Sql不存在,无法执行分页");
        String where = sqlNode.whereSql;
        int pageSize = pageDto.pageSize;
        int p = pageDto.page;
        int start = ((p - 1) * pageSize) + 1;
        final List<RequestParam> params = pageDto.params;
        final List<Object> query_params = pageDto.query_params;
        if ((params.isEmpty()) && (query_params.isEmpty())) {
            return Db.paginate(start, pageSize, sqlNode.selectSql, where);
        } else {

            if (!params.isEmpty()) {
                where += (sqlNode.condition ? StringPool.SPACE : " WHERE 1=1 ");
            }
            for (RequestParam param : pageDto.params) {
                where += param.toSql();
            }
            return Db.paginate(start, pageSize, sqlNode.selectSql, where, query_params.toArray());
        }
    }
public static Page < Record > paginate ( String sqlPaginatePrefix , PageDto pageDto ) { SqlNode sqlNode = SqlKit . sqlNode ( sqlPaginatePrefix + ".paginate" ) ; Preconditions . checkNotNull ( sqlNode , "[" + sqlPaginatePrefix + ".paginate]分页Sql不存在,无法执行分页"); String where = sqlNode . whereSql ; int pageSize = pageDto . pageSize ; int p = pageDto . page ; int start = ( ( p - 1 ) * pageSize ) + 1 ; final List < RequestParam > params = pageDto . params ; final List < Object > query_params = pageDto . query_params ; if ( ( params . isEmpty ( ) ) && ( query_params . isEmpty ( ) ) ) { return Db . paginate ( start , pageSize , sqlNode . selectSql , where ) ; } else { if ( ! params . isEmpty ( ) ) { where += ( sqlNode . condition ? StringPool . SPACE : " WHERE 1=1 " ) ; } for ( RequestParam param : pageDto . params ) { where += param . toSql ( ) ; } return Db . paginate ( start , pageSize , sqlNode . selectSql , where , query_params . toArray ( ) ) ; } }
Paging retrieve, default sorted by id, you need to specify the datatables request parameters.

@param sqlPaginatePrefix 分页搜索前缀
@param pageDto           required parameter.
@return Paging data.
Paging retrieve default sorted by id you need to specify the datatables request parameters .