浏览代码

fix findandcount bug

xormplus 7 年之前
父节点
当前提交
12527f1d8e
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      session_find.go

+ 7 - 0
session_find.go

@@ -47,8 +47,15 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
 	}
 
 	sliceElementType := sliceValue.Type().Elem()
+	if sliceElementType.Kind() == reflect.Ptr {
+		sliceElementType = sliceElementType.Elem()
+	}
 	session.autoResetStatement = true
 
+	if session.statement.selectStr != "" {
+		session.statement.selectStr = ""
+	}
+
 	return session.Count(reflect.New(sliceElementType).Interface())
 }