fix
This commit is contained in:
@@ -89,7 +89,7 @@ func (r *GormWalletRepository) CreateBatch(ctx context.Context, wallets []entiti
|
||||
|
||||
func (r *GormWalletRepository) GetByIDs(ctx context.Context, ids []string) ([]entities.Wallet, error) {
|
||||
var wallets []entities.Wallet
|
||||
err := r.GetDB(ctx).Where("id IN ?", ids).Find(&wallets).Error
|
||||
err := r.GetDB(ctx).Where("id IN ?", ids).Order("created_at DESC").Find(&wallets).Error
|
||||
return wallets, err
|
||||
}
|
||||
|
||||
@@ -120,6 +120,9 @@ func (r *GormWalletRepository) List(ctx context.Context, options interfaces.List
|
||||
order += " ASC"
|
||||
}
|
||||
query = query.Order(order)
|
||||
} else {
|
||||
// 默认按创建时间倒序
|
||||
query = query.Order("created_at DESC")
|
||||
}
|
||||
if options.Page > 0 && options.PageSize > 0 {
|
||||
offset := (options.Page - 1) * options.PageSize
|
||||
|
||||
Reference in New Issue
Block a user