forked from mirror/gorm
Change buildCondition TableName to struct's TableName when query is interface{} (#2011)
This commit is contained in:
parent
31ec9255cd
commit
53995294ef
4
scope.go
4
scope.go
|
@ -586,10 +586,10 @@ func (scope *Scope) buildCondition(clause map[string]interface{}, include bool)
|
|||
scope.Err(fmt.Errorf("invalid query condition: %v", value))
|
||||
return
|
||||
}
|
||||
|
||||
scopeQuotedTableName := newScope.QuotedTableName()
|
||||
for _, field := range newScope.Fields() {
|
||||
if !field.IsIgnored && !field.IsBlank {
|
||||
sqls = append(sqls, fmt.Sprintf("(%v.%v %s %v)", quotedTableName, scope.Quote(field.DBName), equalSQL, scope.AddToVars(field.Field.Interface())))
|
||||
sqls = append(sqls, fmt.Sprintf("(%v.%v %s %v)", scopeQuotedTableName, scope.Quote(field.DBName), equalSQL, scope.AddToVars(field.Field.Interface())))
|
||||
}
|
||||
}
|
||||
return strings.Join(sqls, " AND ")
|
||||
|
|
Loading…
Reference in New Issue