From b3d2f3b182270670842abe7485bccb5cb248ecc4 Mon Sep 17 00:00:00 2001 From: CNCSMonster <99234657+CNCSMonster@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:36:51 +0800 Subject: [PATCH] feat:order logs by time desc (#1250) --- pkg/common/db/relation/log_model.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/common/db/relation/log_model.go b/pkg/common/db/relation/log_model.go index bf39512e8..53365ca5b 100644 --- a/pkg/common/db/relation/log_model.go +++ b/pkg/common/db/relation/log_model.go @@ -24,6 +24,7 @@ func (l *LogGorm) Search(ctx context.Context, keyword string, start time.Time, e if end.UnixMilli() != 0 { db = l.db.WithContext(ctx).Where("create_time <= ?", end) } + db = db.Order("create_time desc") return ormutil.GormSearch[relationtb.Log](db, []string{"user_id"}, keyword, pageNumber, showNumber) }