Simple the code

This commit is contained in:
Lunny Xiao 2023-07-26 08:56:34 +08:00
parent f3d0d7567b
commit 3a9bb64540
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 2 additions and 8 deletions

View File

@ -151,7 +151,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
return 0, err
}
var autoCond builder.Cond
var autoCond builder.Cond = builder.NewCond()
if len(condiBean) > 0 {
autoCond, err = session.genAutoCond(condiBean[0])
if err != nil {
@ -159,13 +159,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
}
} else if table != nil {
if col := table.DeletedColumn(); col != nil && !session.statement.GetUnscoped() { // tag "deleted" is enabled
autoCond1 := session.statement.CondDeleted(col)
if autoCond == nil {
autoCond = autoCond1
} else {
autoCond = autoCond.And(autoCond1)
}
autoCond = autoCond.And(session.statement.CondDeleted(col))
}
}