优化 limit offset 语句生成

This commit is contained in:
2024-05-08 14:36:30 +08:00
parent ae08f2d905
commit ea06a2f16b
3 changed files with 33 additions and 13 deletions

View File

@ -200,9 +200,9 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, optionFuncList ...SetOption) *gorm
// 设置 limit offset
if o.Limit > 0 {
tx = tx.Limit(o.Limit)
}
if o.Offset >= 0 {
tx = tx.Offset(o.Offset)
if o.Offset >= 0 {
tx = tx.Offset(o.Offset)
}
}
// in 语句