From 7667aca4c2f60f85fd74ea642d35aeeabeb954f7 Mon Sep 17 00:00:00 2001 From: John Guo Date: Wed, 23 Jun 2021 09:42:10 +0800 Subject: [PATCH] improve Order feature for package gdb --- database/gdb/gdb_model_condition.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/database/gdb/gdb_model_condition.go b/database/gdb/gdb_model_condition.go index 669c2d8fd..5a83e4e96 100644 --- a/database/gdb/gdb_model_condition.go +++ b/database/gdb/gdb_model_condition.go @@ -277,6 +277,9 @@ func (m *Model) Order(orderBy ...string) *Model { return m } model := m.getModel() + if model.orderBy != "" { + model.orderBy += "," + } model.orderBy = m.db.GetCore().QuoteString(strings.Join(orderBy, " ")) return model } @@ -287,6 +290,9 @@ func (m *Model) OrderAsc(column string) *Model { return m } model := m.getModel() + if model.orderBy != "" { + model.orderBy += "," + } model.orderBy = m.db.GetCore().QuoteWord(column) + " ASC" return model } @@ -297,6 +303,9 @@ func (m *Model) OrderDesc(column string) *Model { return m } model := m.getModel() + if model.orderBy != "" { + model.orderBy += "," + } model.orderBy = m.db.GetCore().QuoteWord(column) + " DESC" return model }