From f94ac02030c3ab49c26e9aa922014a8613b2cdb5 Mon Sep 17 00:00:00 2001 From: hulutech-web Date: Thu, 7 Nov 2024 12:20:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E6=96=B0=E5=A4=8D=E5=88=B6=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- paginator.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/paginator.go b/paginator.go index 4cf5e54..0a1074e 100644 --- a/paginator.go +++ b/paginator.go @@ -52,8 +52,6 @@ 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 { //处理日期时间 @@ -104,6 +102,7 @@ func (r *HttpResult) ResultPagination(dest any, withes ...string) (http.Response for _, with := range withes { r.Query = r.Query.With(with) } + r.Query = r.Query.OrderByDesc("id") r.Query.Paginate(currentPageInt, pageSizeInt, dest, &total) URL_PATH := r.Context.Request().Origin().URL.Path