From 653c991aade0645f359ce8a19e58a92a7482edc4 Mon Sep 17 00:00:00 2001 From: han2015 <1019850453@qq.com> Date: Tue, 10 Feb 2026 16:13:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=EF=BC=9A=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/customerform/formTableList.go | 9 +++++++-- api/version1/customerform/type.go | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/version1/customerform/formTableList.go b/api/version1/customerform/formTableList.go index 58ba76c..05963db 100644 --- a/api/version1/customerform/formTableList.go +++ b/api/version1/customerform/formTableList.go @@ -60,6 +60,10 @@ func (a *ApiMethod) GainFormPageListContNew(c *gin.Context) { if requestData.PageSize == 0 { requestData.Page = 20 } + + if requestData.SortData == "" { + requestData.SortData = "`id` DESC" + } context, _ := c.Get(overall.MyContJwt) var userCont modelshr.ManCont userCont.GetLoginCont(context) //当前操作人 @@ -123,7 +127,8 @@ func (a *ApiMethod) GainFormPageListContNew(c *gin.Context) { //Step 5 获取每页具体数据 var formList []map[string]interface{} gormDb = publicmethod.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) - err = gormDb.Order("`id` DESC").Find(&formList).Error + + err = gormDb.Order(requestData.SortData).Find(&formList).Error if err != nil && len(formList) < 1 { publicmethod.Result(0, err, c) return @@ -206,7 +211,7 @@ func (a *ApiMethod) GainFormPageListContNew(c *gin.Context) { } //Step 4 翻页配置 gormDb = publicmethod.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) - err = gormDb.Order("f.`id` DESC").Find(&formList).Error + err = gormDb.Order(requestData.SortData).Find(&formList).Error fmt.Printf("err----%v------->%v\n\n\n", formJsonCont.Form.DataSource, err) if err != nil && len(formList) < 1 { publicmethod.Result(0, err, c) diff --git a/api/version1/customerform/type.go b/api/version1/customerform/type.go index 4bf13be..95faa50 100644 --- a/api/version1/customerform/type.go +++ b/api/version1/customerform/type.go @@ -506,6 +506,7 @@ type FormPageListAttr struct { FormId string `json:"formId"` publicmethod.PagesTurn SearchData string `json:"searchData"` + SortData string `json:"sortData"` } // 查询按钮类型