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)