Merge pull request #2017 from wanyaoqi/bugfix/wyq/fix-list-order-by

bugfix: fix list order by
This commit is contained in:
yunion-ci-robot
2019-07-31 02:22:58 +08:00
committed by GitHub
+3
View File
@@ -512,6 +512,9 @@ func ListItems(manager IModelManager, ctx context.Context, userCred mcclient.Tok
orderBy = append(orderBy, primaryCol.Name())
} else if manager.TableSpec().ColumnSpec("created_at") != nil {
orderBy = append(orderBy, "created_at")
if primaryCol != nil {
orderBy = append(orderBy, primaryCol.Name())
}
}
for _, orderByField := range orderBy {
colSpec := manager.TableSpec().ColumnSpec(orderByField)