use of org.summerb.approaches.jdbccrud.api.query.OrderBy in project summerb by skarpushin.
the class EasyCrudDaoMySqlImpl method buildOrderBySubclause.
private String buildOrderBySubclause(OrderBy[] orderBy) {
if (orderBy == null || orderBy.length == 0) {
return "";
}
StringBuilder ret = new StringBuilder();
ret.append(" ORDER BY ");
for (int i = 0; i < orderBy.length; i++) {
if (i > 0) {
ret.append(", ");
}
OrderBy o = orderBy[i];
ret.append(QueryToNativeSqlCompilerMySqlImpl.underscore(o.getFieldName()));
ret.append(" ");
Preconditions.checkArgument(allowedSortDirections.contains(o.getDirection().toLowerCase()), "OrderBy not allowed: " + o.getDirection());
ret.append(o.getDirection());
}
return ret.toString();
}
Aggregations