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"` } // 查询按钮类型