价格统计
This commit is contained in:
@@ -292,3 +292,33 @@ func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, skuNameID int, sn
|
||||
}
|
||||
return priceReferSnapshot, totalCount, err
|
||||
}
|
||||
|
||||
func GetPriceReferSnapshotNoPage(db *DaoDB, cityCodes, skuIDs, skuNameIDs []int, snapDate time.Time) (priceReferSnapshot []*model.PriceReferSnapshot, err error) {
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM price_refer_snapshot a
|
||||
WHERE 1=1
|
||||
AND a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if len(skuNameIDs) > 0 {
|
||||
sql += " AND a.name_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sqlParams = append(sqlParams, skuNameIDs)
|
||||
}
|
||||
if len(skuIDs) > 0 {
|
||||
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sqlParams = append(sqlParams, skuIDs)
|
||||
}
|
||||
if len(cityCodes) > 0 {
|
||||
sql += " AND a.city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")"
|
||||
sqlParams = append(sqlParams, cityCodes)
|
||||
}
|
||||
if !utils.IsTimeZero(snapDate) {
|
||||
sql += " AND a.snapshot_at = ?"
|
||||
sqlParams = append(sqlParams, snapDate)
|
||||
}
|
||||
err = GetRows(db, &priceReferSnapshot, sql, sqlParams...)
|
||||
return priceReferSnapshot, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user