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 }