From 7677cd470a33561a6c23f7a0ddffadbc1c904cc1 Mon Sep 17 00:00:00 2001 From: timerzz Date: Wed, 4 Sep 2024 15:35:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E7=BB=99=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=8A=A0=E4=B8=8Aorder=20by?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/article.go | 2 +- structs/storage/provider.go | 2 +- structs/storage/seller.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/structs/storage/article.go b/structs/storage/article.go index 7f1d3d4..759a866 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -111,7 +111,7 @@ func (a *articleApi) List(query PageListQuery) (articles []v2.Article, total int if err != nil { return } - err = a.db.Scopes(query.Scope).Find(&articles).Error + err = a.db.Scopes(query.Scope).Order("id").Find(&articles).Error return } diff --git a/structs/storage/provider.go b/structs/storage/provider.go index cfbd460..c208b9f 100644 --- a/structs/storage/provider.go +++ b/structs/storage/provider.go @@ -63,7 +63,7 @@ func (p *providerApi) List(query PageListQuery) (providers []v2.Provider, total if err != nil { return } - err = p.db.Scopes(query.Scope).Find(&providers).Error + err = p.db.Scopes(query.Scope).Order("id DESC").Find(&providers).Error return } diff --git a/structs/storage/seller.go b/structs/storage/seller.go index 7f6b39e..8543888 100644 --- a/structs/storage/seller.go +++ b/structs/storage/seller.go @@ -63,7 +63,7 @@ func (p *sellerApi) List(query PageListQuery) (sellers []v2.Seller, total int64, if err != nil { return } - err = p.db.Scopes(query.Scope).Find(&sellers).Error + err = p.db.Scopes(query.Scope).Order("id DESC").Find(&sellers).Error return }