Include default search attributes when query with Join, close #906

This commit is contained in:
Jinzhu 2016-03-14 08:05:36 +08:00
parent 1819dda80a
commit 83002c4d5f
1 changed files with 3 additions and 0 deletions

View File

@ -712,6 +712,9 @@ func (scope *Scope) whereSQL() (sql string) {
func (scope *Scope) selectSQL() string { func (scope *Scope) selectSQL() string {
if len(scope.Search.selects) == 0 { if len(scope.Search.selects) == 0 {
if len(scope.Search.joinConditions) > 0 {
return fmt.Sprintf("%v.*", scope.QuotedTableName())
}
return "*" return "*"
} }
return scope.buildSelectQuery(scope.Search.selects) return scope.buildSelectQuery(scope.Search.selects)