feat 给数据库操作加上order by

This commit is contained in:
timerzz 2024-09-04 15:35:47 +08:00
parent 4e3069f229
commit 7677cd470a
3 changed files with 3 additions and 3 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}