Fix find and count bug #1651

Merged
lunny merged 3 commits from lunny/fix_bug into master 2020-06-13 05:31:36 +00:00
Showing only changes of commit 378fb1e642 - Show all commits

View File

@ -60,6 +60,9 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
if session.statement.OrderStr != "" {
session.statement.OrderStr = ""
}
if session.statement.LimitN != nil {
session.statement.LimitN = nil
}
// session has stored the conditions so we use `unscoped` to avoid duplicated condition.
return session.Unscoped().Count(reflect.New(sliceElementType).Interface())