diff --git a/gorose.go b/gorose.go index 23d3b85..125f2c4 100644 --- a/gorose.go +++ b/gorose.go @@ -16,7 +16,7 @@ const ( // VERSION_TEXT ... VERSION_TEXT = "\ngolang orm of gorose's version : " // VERSION_NO ... - VERSION_NO = "v2.2.0" + VERSION_NO = "v1.3.0" // VERSION ... VERSION = VERSION_TEXT + VERSION_NO + GOROSE_IMG ) diff --git a/orm_query.go b/orm_query.go index 9d9e1db..f83babb 100644 --- a/orm_query.go +++ b/orm_query.go @@ -413,18 +413,19 @@ func (dba *Orm) Paginate(page ...int) (res Data, err error) { } var offset = dba.GetOffset() var currentPage = int(math.Ceil(float64(offset+1) / float64(limit))) - //dba.ResetUnion() - // 获取结果 - resData, err := dba.Get() - if err != nil { - return - } + // 统计总量 dba.offset = 0 count, err := dba.Count() var lastPage = int(math.Ceil(float64(count) / float64(limit))) var nextPage = currentPage + 1 var prevPage = currentPage - 1 + //dba.ResetUnion() + // 获取结果 + resData, err := dba.Get() + if err != nil { + return + } res = Data{ "total": count, "per_page": limit,