resolved #199
This commit is contained in:
parent
a068aadd27
commit
ba131dd9a0
12
session.go
12
session.go
|
@ -1173,11 +1173,19 @@ func (session *Session) Find(rowsSlicePtr interface{}, condiBean ...interface{})
|
||||||
var columnStr string = session.Statement.ColumnStr
|
var columnStr string = session.Statement.ColumnStr
|
||||||
if session.Statement.JoinStr == "" {
|
if session.Statement.JoinStr == "" {
|
||||||
if columnStr == "" {
|
if columnStr == "" {
|
||||||
columnStr = session.Statement.genColumnStr()
|
if session.Statement.GroupByStr != "" {
|
||||||
|
columnStr = session.Statement.Engine.Quote(strings.Replace(session.Statement.GroupByStr, ",", session.Engine.Quote(","), -1))
|
||||||
|
} else {
|
||||||
|
columnStr = session.Statement.genColumnStr()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if columnStr == "" {
|
if columnStr == "" {
|
||||||
columnStr = "*"
|
if session.Statement.GroupByStr != "" {
|
||||||
|
columnStr = session.Statement.Engine.Quote(strings.Replace(session.Statement.GroupByStr, ",", session.Engine.Quote(","), -1))
|
||||||
|
} else {
|
||||||
|
columnStr = "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
statement.go
22
statement.go
|
@ -1142,13 +1142,21 @@ func (statement *Statement) genGetSql(bean interface{}) (string, []interface{})
|
||||||
statement.BeanArgs = args
|
statement.BeanArgs = args
|
||||||
|
|
||||||
var columnStr string = statement.ColumnStr
|
var columnStr string = statement.ColumnStr
|
||||||
if statement.JoinStr == "" {
|
if len(statement.JoinStr) == 0 {
|
||||||
if columnStr == "" {
|
if len(columnStr) == 0 {
|
||||||
columnStr = statement.genColumnStr()
|
if statement.GroupByStr != "" {
|
||||||
|
columnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, ",", statement.Engine.Quote(","), -1))
|
||||||
|
} else {
|
||||||
|
columnStr = statement.genColumnStr()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if columnStr == "" {
|
if len(columnStr) == 0 {
|
||||||
columnStr = "*"
|
if statement.GroupByStr != "" {
|
||||||
|
columnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, ",", statement.Engine.Quote(","), -1))
|
||||||
|
} else {
|
||||||
|
columnStr = "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,12 +1206,12 @@ func (statement *Statement) genCountSql(bean interface{}) (string, []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (statement *Statement) genSelectSql(columnStr string) (a string) {
|
func (statement *Statement) genSelectSql(columnStr string) (a string) {
|
||||||
if statement.GroupByStr != "" {
|
/*if statement.GroupByStr != "" {
|
||||||
if columnStr == "" {
|
if columnStr == "" {
|
||||||
columnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, ",", statement.Engine.Quote(","), -1))
|
columnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, ",", statement.Engine.Quote(","), -1))
|
||||||
}
|
}
|
||||||
//statement.GroupByStr = columnStr
|
//statement.GroupByStr = columnStr
|
||||||
}
|
}*/
|
||||||
var distinct string
|
var distinct string
|
||||||
if statement.IsDistinct {
|
if statement.IsDistinct {
|
||||||
distinct = "DISTINCT "
|
distinct = "DISTINCT "
|
||||||
|
|
Loading…
Reference in New Issue