- use MAX instead of AVG in GetStoreOpRequests for unitPrice
This commit is contained in:
@@ -259,9 +259,7 @@ func GetStoreSkus(ctx *jxcontext.Context, storeID int, isFocus bool, keyword str
|
||||
}()
|
||||
// globals.SugarLogger.Debug(sqlData, sqlParams)
|
||||
if err = dao.GetRows(db, &skuNamesInfo.SkuNames, sqlData, sqlParams...); err == nil {
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
skuNamesInfo.TotalCount = countInfo.Ct
|
||||
skuNamesInfo.TotalCount = dao.GetLastTotalRowCount(db)
|
||||
for _, skuName := range skuNamesInfo.SkuNames {
|
||||
if skuName.SkusStr != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.SkusStr), &skuName.Skus); err != nil {
|
||||
@@ -368,7 +366,6 @@ func GetStoreSkus(ctx *jxcontext.Context, storeID int, isFocus bool, keyword str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
return skuNamesInfo, err
|
||||
}
|
||||
@@ -1008,7 +1005,7 @@ func GetStoreOpRequests(ctx *jxcontext.Context, fromTime, toTime time.Time, keyw
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
t1.id, t1.created_at, t1.updated_at, t1.last_operator, t1.deleted_at,
|
||||
t1.type, t1.store_id, t1.item_id, t1.status, t1.user_id, t1.int_param1, t1.int_param2,
|
||||
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, AVG(t5.unit_price) unit_price
|
||||
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, MAX(t5.unit_price) unit_price
|
||||
FROM store_op_request t1
|
||||
JOIN store t2 ON t1.store_id = t2.id
|
||||
JOIN sku_name t3 ON t1.item_id = t3.id
|
||||
|
||||
Reference in New Issue
Block a user