Fix find and count bug with cols #1826
|
@ -552,6 +552,13 @@ func TestFindAndCountOneFunc(t *testing.T) {
|
|||
assert.EqualValues(t, 1, len(results))
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
|
||||
results = make([]FindAndCountStruct, 0, 1)
|
||||
cnt, err = testEngine.Where("msg = ?", true).Cols("id", "content", "msg").
|
||||
Limit(1).FindAndCount(&results)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, len(results))
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
|
||||
results = make([]FindAndCountStruct, 0, 1)
|
||||
cnt, err = testEngine.Where("msg = ?", true).Desc("id").
|
||||
Limit(1).Cols("content").FindAndCount(&results)
|
||||
|
|
|
@ -57,6 +57,9 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
|
|||
if session.statement.SelectStr != "" {
|
||||
session.statement.SelectStr = ""
|
||||
}
|
||||
if len(session.statement.ColumnMap) > 0 {
|
||||
session.statement.ColumnMap = []string{}
|
||||
}
|
||||
if session.statement.OrderStr != "" {
|
||||
session.statement.OrderStr = ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user