aa
This commit is contained in:
@@ -1175,7 +1175,20 @@ type GetStoreManageStateResult struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
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 := `
|
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
|
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
|
FROM store_manage_state a
|
||||||
@@ -1193,8 +1206,13 @@ func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset,
|
|||||||
sqlParams = append(sqlParams, vendorID)
|
sqlParams = append(sqlParams, vendorID)
|
||||||
}
|
}
|
||||||
if sortType != 0 {
|
if sortType != 0 {
|
||||||
sql += " ORDER BY"
|
if GetStoreManageStateSortTypeMap[sortType] != "" {
|
||||||
sqlParams = append(sqlParams, sortType)
|
sql += " ORDER BY " + GetStoreManageStateSortTypeMap[sortType]
|
||||||
|
if sortType < 0 {
|
||||||
|
sql += " DESC"
|
||||||
|
}
|
||||||
|
sqlParams = append(sqlParams, sortType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sql += " LIMIT ? OFFSET ?"
|
sql += " LIMIT ? OFFSET ?"
|
||||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user