添加cid数据库db的查询orderby desc
This commit is contained in:
parent
832443e1d2
commit
4cbb9b1201
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue