From ce5adfaafebd6cb9f47ae0e41e8f85db7320bbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Mar 2021 17:51:53 +0800 Subject: [PATCH] aa --- business/model/dao/store.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 91d3628b0..720efc095 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -1175,7 +1175,20 @@ type GetStoreManageStateResult struct { } func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { - var requestList []*GetStoreManageStateResult + var ( + requestList []*GetStoreManageStateResult + GetStoreManageStateSortTypeMap = map[int]string{ + 1: "a.cover_area", + 2: "c.market_scale", + 3: "a.open_time", + 4: "a.sku_count", + 5: "a.high_sku_count", + 6: "a.act_ample", + 7: "a.null_order_count", + 8: "a.refuse_order_count", + 9: "a.store_score", + } + ) sql := ` SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.name store_name, c.vendor_store_id, c.market_scale, b.comment, c.cover_area default_cover_area FROM store_manage_state a @@ -1193,8 +1206,13 @@ func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset, sqlParams = append(sqlParams, vendorID) } if sortType != 0 { - sql += " ORDER BY" - sqlParams = append(sqlParams, sortType) + if GetStoreManageStateSortTypeMap[sortType] != "" { + sql += " ORDER BY " + GetStoreManageStateSortTypeMap[sortType] + if sortType < 0 { + sql += " DESC" + } + sqlParams = append(sqlParams, sortType) + } } sql += " LIMIT ? OFFSET ?" pageSize = jxutils.FormalizePageSize(pageSize)