From 90e03520fbd377fe67c8d46430eba7b30b0052fd Mon Sep 17 00:00:00 2001 From: cncsmonster Date: Thu, 19 Oct 2023 10:26:22 +0800 Subject: [PATCH] feat:order logs by time desc --- 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) }