mirror of https://github.com/go-gorm/gorm.git
Update callback_query_preload.go (#1553)
This commit is contained in:
parent
35fb16eeba
commit
6f64b8610d
|
@ -289,7 +289,12 @@ func (scope *Scope) handleManyToManyPreload(field *Field, conditions []interface
|
||||||
|
|
||||||
// generate query with join table
|
// generate query with join table
|
||||||
newScope := scope.New(reflect.New(fieldType).Interface())
|
newScope := scope.New(reflect.New(fieldType).Interface())
|
||||||
preloadDB = preloadDB.Table(newScope.TableName()).Model(newScope.Value).Select("*")
|
preloadDB = preloadDB.Table(newScope.TableName()).Model(newScope.Value)
|
||||||
|
|
||||||
|
if len(preloadDB.search.selects) == 0 {
|
||||||
|
preloadDB = preloadDB.Select("*")
|
||||||
|
}
|
||||||
|
|
||||||
preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value)
|
preloadDB = joinTableHandler.JoinWith(joinTableHandler, preloadDB, scope.Value)
|
||||||
|
|
||||||
// preload inline conditions
|
// preload inline conditions
|
||||||
|
|
Loading…
Reference in New Issue