gorm 支持model

This commit is contained in:
2024-01-15 15:20:27 +08:00
parent 1a63a89faf
commit f6bac5a5a0
4 changed files with 22 additions and 2 deletions

View File

@ -187,6 +187,10 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, optionFuncList ...SetOption) *gorm
tx = tx.Table(b.TableName)
}
if nil != o.Model {
tx = tx.Model(o.Model)
}
// 设置where条件
if nil != o.Where && len(o.Where) > 0 {
tx = tx.Where(o.Where)