门店价格修改

This commit is contained in:
苏尹岚
2019-12-13 10:49:29 +08:00
parent 9717defad6
commit 147a683177
7 changed files with 21 additions and 22 deletions

View File

@@ -188,10 +188,10 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapshot []*model.PriceReferSnapshot, err error) {
sql := `
SELECT b.city_code,a.sku_id,
MAX(a.price) max_price,
MIN(a.price) min_price,
ROUND(AVG(a.price)) avg_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT((a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100 ORDER BY (a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100),',',Count(1)/2),',',-1),2) mid_price,
ROUND(MAX(a.price/IF(b.pay_percentage=0,100,b.pay_percentage)*100)) max_price,
ROUND(MIN(a.price/IF(b.pay_percentage=0,100,b.pay_percentage)*100)) min_price,
ROUND(AVG(a.price/IF(b.pay_percentage=0,100,b.pay_percentage)*100)) avg_price,
ROUND(SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT((a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100 ORDER BY (a.price/IF(b.pay_percentage=0,100,b.pay_percentage))*100),',',Count(1)/2),',',-1)) mid_price,
MAX(a.jd_price) max_jd_price,
MIN(a.jd_price) min_jd_price,
ROUND(AVG(a.jd_price)) avg_jd_price,
@@ -211,8 +211,7 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
t1.min_vendor_price,
t1.avg_vendor_price
FROM store_sku_bind a
JOIN store b ON a.store_id = b.id AND b.deleted_at = ?
JOIN sku d ON a.sku_id = d.id AND d.deleted_at = ?
JOIN store b ON a.store_id = b.id AND b.deleted_at = ? AND b.status != ?
LEFT JOIN (
SELECT SUM(t1.count),t1.sku_id,MAX(t1.sale_price) max_sale_price,MIN(t1.sale_price) min_sale_price,ROUND(AVG(t1.sale_price)) avg_sale_price,MAX(t1.vendor_price) max_vendor_price,MIN(t1.vendor_price) min_vendor_price,ROUND(AVG(t1.vendor_price)) avg_vendor_price
FROM order_sku t1
@@ -220,12 +219,14 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
GROUP BY 2
)t1 ON t1.sku_id = a.sku_id
WHERE a.deleted_at = ?
AND a.status = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
utils.DefaultTimeValue,
model.StoreStatusDisabled,
time.Now().AddDate(0, -1, 0),
utils.DefaultTimeValue,
model.SkuStatusNormal,
}
if len(skuIDs) > 0 {
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"

View File

@@ -493,7 +493,7 @@ func GetStorePriceScore(db *DaoDB, storeIDs []int, fromScore, toScore, sort int,
WHERE 1=1
`
sqlParams := []interface{}{}
if fromScore != 0 && toScore != 0 {
if fromScore != 0 || toScore != 0 {
sql += " AND a.score BETWEEN ? AND ?"
sqlParams = append(sqlParams, fromScore, toScore)
}