goja-web/src/main/java/goja/mvc/datatables/DTDao.java
public static Page<Record> paginate(String where,
                                        String sql_columns,
                                        DTCriterias criterias,
                                        List<Object> params) {
        int pageSize = criterias.getLength();
        int start = criterias.getStart() / pageSize + 1;

        StringBuilder where_sql = new StringBuilder(where);

        final List<Triple<String, Condition, Object>> custom_params = criterias.getParams();
        if (!custom_params.isEmpty()) {
            boolean append_and = StringUtils.containsIgnoreCase(where, "WHERE");
            if (!append_and) {
                where_sql.append(SQL_WHERE);
            }
            itemCustomParamSql(params, where_sql, custom_params, append_and);
        }

        final List<DTOrder> order = criterias.getOrder();
        if (order != null && !order.isEmpty()) {
            StringBuilder orderBy = new StringBuilder();
            for (DTOrder _order : order)
                orderBy.append(_order.getColumn()).append(StringPool.SPACE).append(_order.getDir());
            final String byColumns = orderBy.toString();
            if (!Strings.isNullOrEmpty(byColumns)) {
                where_sql.append(" ORDER BY ").append(byColumns);
            }
        }

        if (params == null || params.isEmpty()) {
            return Db.paginate(start, pageSize, sql_columns, where_sql.toString());
        } else {

            return Db.paginate(start, pageSize, sql_columns, where_sql.toString(), params.toArray());
        }
    }
public static Page<Record> paginate(String where,
                                        String sql_columns,
                                        DTCriterias criterias,
                                        List<Object> params) {
        int pageSize = criterias.getLength();
        int start = criterias.getStart() / pageSize + 1;

        StringBuilder where_sql = new StringBuilder(where);

        final List<Triple<String, Condition, Object>> custom_params = criterias.getParams();
        if (!custom_params.isEmpty()) {
            boolean append_and = StringUtils.containsIgnoreCase(where, "WHERE");
            if (!append_and) {
                where_sql.append(SQL_WHERE);
            }
            itemCustomParamSql(params, where_sql, custom_params, append_and);
        }

        final List<DTOrder> order = criterias.getOrder();
        if (order != null && !order.isEmpty()) {
            StringBuilder orderBy = new StringBuilder();
            for (DTOrder _order : order)
                orderBy.append(_order.getColumn()).append(StringPool.SPACE).append(_order.getDir());
            final String byColumns = orderBy.toString();
            if (!Strings.isNullOrEmpty(byColumns)) {
                where_sql.append(" ORDER BY ").append(byColumns);
            }
        }

        if (params == null || params.isEmpty()) {
            return Db.paginate(start, pageSize, sql_columns, where_sql.toString());
        } else {

            return Db.paginate(start, pageSize, sql_columns, where_sql.toString(), params.toArray());
        }
    }
public static Page < Record > paginate ( String where , String sql_columns , DTCriterias criterias , List < Object > params ) { int pageSize = criterias . getLength ( ) ; int start = criterias . getStart ( ) / pageSize + 1 ; StringBuilder where_sql = new StringBuilder ( where ) ; final List < Triple < String , Condition , Object > > custom_params = criterias . getParams ( ) ; if ( ! custom_params . isEmpty ( ) ) { boolean append_and = StringUtils . containsIgnoreCase ( where , "WHERE" ) ; if ( ! append_and ) { where_sql . append ( SQL_WHERE ) ; } itemCustomParamSql ( params , where_sql , custom_params , append_and ) ; } final List < DTOrder > order = criterias . getOrder ( ) ; if ( order != null && ! order . isEmpty ( ) ) { StringBuilder orderBy = new StringBuilder ( ) ; for ( DTOrder _order : order ) orderBy . append ( _order . getColumn ( ) ) . append ( StringPool . SPACE ) . append ( _order . getDir ( ) ) ; final String byColumns = orderBy . toString ( ) ; if ( ! Strings . isNullOrEmpty ( byColumns ) ) { where_sql . append ( " ORDER BY " ) . append ( byColumns ) ; } } if ( params == null || params . isEmpty ( ) ) { return Db . paginate ( start , pageSize , sql_columns , where_sql . toString ( ) ) ; } else { return Db . paginate ( start , pageSize , sql_columns , where_sql . toString ( ) , params . toArray ( ) ) ; } }
Paging retrieve, default sorted by id, you need to specify the datatables request parameters.

@param where       FROM WHERE SQL.
@param sql_columns SELECT column sql.
@param criterias   required parameter
@return Paging data.
Paging retrieve default sorted by id you need to specify the datatables request parameters .