mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-09 05:48:20 +00:00
WIP SQL console: better sorting of result columns
This commit is contained in:
parent
ff67a04b3f
commit
24c6972df7
@ -14,7 +14,15 @@ public class DbQueryResultRow {
|
||||
}
|
||||
|
||||
public List<DbQueryOutputField> getSortedFields() {
|
||||
return values.keySet().stream().sorted((f1, f2) -> f1.getName().compareTo(f2.getName())).toList();
|
||||
return values.keySet().stream().sorted((f1, f2) -> {
|
||||
if (f1.isPrimaryKey() && !f2.isPrimaryKey()) {
|
||||
return -1;
|
||||
} else if (!f1.isPrimaryKey() && f2.isPrimaryKey()) {
|
||||
return 1;
|
||||
} else {
|
||||
return f1.getName().compareTo(f2.getName());
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public String getQuery() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user