fix sql in SQLProvider.listOrder

This commit is contained in:
Timi
2025-11-03 16:08:35 +08:00
parent 1688666dca
commit 945a2c5e9d

View File

@ -67,10 +67,10 @@ public class SQLProvider {
sql.deleteCharAt(sql.length() - 2);
} else {
if (meta.canCreate && !meta.canUpdate) {
sql.append("created_at DESC");
sql.append(" ORDER BY created_at DESC");
}
if (meta.canCreate && meta.canUpdate) {
sql.append("COALESCE(updated_at, created_at) DESC");
sql.append(" ORDER BY COALESCE(updated_at, created_at) DESC");
}
}
return sql.append(" LIMIT %s, %s".formatted(offset, limit)).toString();