价格统计

This commit is contained in:
苏尹岚
2019-12-31 14:47:17 +08:00
parent 7c0e3a5e5c
commit 71c9a173b9
6 changed files with 2357 additions and 2386 deletions

View File

@@ -195,6 +195,10 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
ROUND(MIN(a.price/IF(b.pay_percentage < 50,70,b.pay_percentage)*100)) min_price,
ROUND(AVG(a.price/IF(b.pay_percentage < 50,70,b.pay_percentage)*100)) avg_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT((a.price/IF(b.pay_percentage < 50,70,b.pay_percentage))*100 ORDER BY (a.price/IF(b.pay_percentage < 50,70,b.pay_percentage))*100),',',Count(1)/2),',',-1)) mid_price,
ROUND(MAX(a.unit_price/IF(b.pay_percentage < 50,70,b.pay_percentage)*100)) max_unit_price,
ROUND(MIN(a.unit_price/IF(b.pay_percentage < 50,70,b.pay_percentage)*100)) min_unit_price,
ROUND(AVG(a.unit_price/IF(b.pay_percentage < 50,70,b.pay_percentage)*100)) avg_unit_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT((a.unit_price/IF(b.pay_percentage < 50,70,b.pay_percentage))*100 ORDER BY (a.unit_price/IF(b.pay_percentage < 50,70,b.pay_percentage))*100),',',Count(1)/2),',',-1)) mid_unit_price,
MAX(a.jd_price) max_jd_price,
MIN(a.jd_price) min_jd_price,
ROUND(AVG(a.jd_price)) avg_jd_price,
@@ -322,3 +326,14 @@ func GetPriceReferSnapshotNoPage(db *DaoDB, cityCodes, skuIDs, skuNameIDs []int,
err = GetRows(db, &priceReferSnapshot, sql, sqlParams...)
return priceReferSnapshot, err
}
func DeletePriceReferHistory(db *DaoDB, snapDate time.Time) (num int64, err error) {
sql := `
DELETE FROM price_refer_snapshot
WHERE snapshot_at <= ?
`
sqlParams := []interface{}{
snapDate,
}
return ExecuteSQL(db, sql, sqlParams...)
}