From 4cbb9b12010b0b8759e7aab5af8bede32854641d Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sun, 14 Dec 2025 18:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0cid=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93db=E7=9A=84=E6=9F=A5=E8=AF=A2orderby=20desc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/dbm.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dao/dbm.go b/dao/dbm.go index 388ed44..7907041 100644 --- a/dao/dbm.go +++ b/dao/dbm.go @@ -144,7 +144,7 @@ func FindDBRunHistoryByAuthID(auth_id int) ([]proto.SQLRunHistory, error) { } else { db2 = DB } - res := db2.Where("user_id = ?", auth_id).Find(&histories) + res := db2.Where("user_id = ?", auth_id).Order("created_at DESC").Limit(100).Find(&histories) if res.Error != nil { return nil, res.Error } @@ -159,7 +159,7 @@ func FindDBRunHistoryByAuthIDAndDbId(auth_id int, db_id uint) ([]proto.SQLRunHis } else { db2 = DB } - res := db2.Where("user_id = ? and db_id = ?", auth_id, db_id).Find(&histories) + res := db2.Where("user_id = ? and db_id = ?", auth_id, db_id).Order("created_at DESC").Limit(100).Find(&histories) if res.Error != nil { return nil, res.Error } @@ -196,7 +196,7 @@ func FindAllSQLRunHistory() ([]proto.SQLRunHistory, error) { } else { db2 = DB } - res := db2.Find(&histories) + res := db2.Order("created_at DESC").Limit(1000).Find(&histories) if res.Error != nil { return nil, res.Error }