improve function
This commit is contained in:
parent
0fdecc7777
commit
e388ef801d
|
@ -478,28 +478,26 @@ func (statement *Statement) GenExistSQL(bean ...interface{}) (string, []interfac
|
||||||
}
|
}
|
||||||
|
|
||||||
func (statement *Statement) genSelectColumnStr() string {
|
func (statement *Statement) genSelectColumnStr() string {
|
||||||
|
// manually select columns
|
||||||
if len(statement.SelectStr) > 0 {
|
if len(statement.SelectStr) > 0 {
|
||||||
return statement.SelectStr
|
return statement.SelectStr
|
||||||
}
|
}
|
||||||
|
|
||||||
columnStr := statement.ColumnStr()
|
columnStr := statement.ColumnStr()
|
||||||
if len(statement.joins) == 0 {
|
if columnStr != "" {
|
||||||
if columnStr == "" {
|
return columnStr
|
||||||
if statement.GroupByStr != "" {
|
|
||||||
columnStr = statement.quoteColumnStr(statement.GroupByStr)
|
|
||||||
} else {
|
|
||||||
columnStr = statement.genColumnStr()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if columnStr == "" {
|
|
||||||
if statement.GroupByStr != "" {
|
|
||||||
columnStr = statement.quoteColumnStr(statement.GroupByStr)
|
|
||||||
} else {
|
|
||||||
columnStr = "*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// autodetect columns
|
||||||
|
if statement.GroupByStr != "" {
|
||||||
|
return statement.quoteColumnStr(statement.GroupByStr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(statement.joins) != 0 {
|
||||||
|
return "*"
|
||||||
|
}
|
||||||
|
|
||||||
|
columnStr = statement.genColumnStr()
|
||||||
if columnStr == "" {
|
if columnStr == "" {
|
||||||
columnStr = "*"
|
columnStr = "*"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue