diff --git a/paginator.go b/paginator.go index b15b81f..4cf5e54 100644 --- a/paginator.go +++ b/paginator.go @@ -52,6 +52,8 @@ func (h *HttpResult) SearchByParams(params map[string]string, conditionMap map[s } query := facades.Orm().Query() + //默认按照时间降序排序 + query.OrderBy("id", "desc") // 再处理url查询 h.Query = func(q orm.Query) orm.Query { //处理日期时间 @@ -102,8 +104,6 @@ func (r *HttpResult) ResultPagination(dest any, withes ...string) (http.Response for _, with := range withes { r.Query = r.Query.With(with) } - //默认按照时间降序排序 - r.Query.OrderBy("id", "desc") r.Query.Paginate(currentPageInt, pageSizeInt, dest, &total) URL_PATH := r.Context.Request().Origin().URL.Path