This commit is contained in:
Lunny Xiao 2020-03-09 09:13:44 +08:00
parent c02c051f3e
commit 59a3ceed43
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 2 additions and 0 deletions

View File

@ -83,6 +83,8 @@ func (statement *Statement) GenSumSQL(bean interface{}, columns ...string) (stri
for _, colName := range columns {
if !strings.Contains(colName, " ") && !strings.Contains(colName, "(") {
colName = statement.quote(colName)
} else {
colName = statement.ReplaceQuote(colName)
}
sumStrs = append(sumStrs, fmt.Sprintf("COALESCE(sum(%s),0)", colName))
}