修复GetStoreSkuPriceAndWeight中的bug
This commit is contained in:
@@ -681,7 +681,7 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve
|
|||||||
SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight
|
SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight
|
||||||
FROM sku t1
|
FROM sku t1
|
||||||
JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.deleted_at = ?
|
JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.deleted_at = ?
|
||||||
JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t2.deleted_at = ?
|
JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t3.deleted_at = ?
|
||||||
%s
|
%s
|
||||||
WHERE %s IN (`+GenQuestionMarks(len(vendorSkuIDs))+`)`, vendorSkuIDField, sqlThingMap, vendorSkuIDField)
|
WHERE %s IN (`+GenQuestionMarks(len(vendorSkuIDs))+`)`, vendorSkuIDField, sqlThingMap, vendorSkuIDField)
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
@@ -694,6 +694,7 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve
|
|||||||
} else {
|
} else {
|
||||||
sqlParams = append(sqlParams, vendorSkuIDs)
|
sqlParams = append(sqlParams, vendorSkuIDs)
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf(sql)
|
||||||
err = GetRows(db, &l, sql, sqlParams...)
|
err = GetRows(db, &l, sql, sqlParams...)
|
||||||
return l, err
|
return l, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,3 +28,11 @@ func TestGetDeletedStoreSkuBind(t *testing.T) {
|
|||||||
storeSkuBind := GetDeletedStoreSkuBind(GetDB(), 100123, 30648)
|
storeSkuBind := GetDeletedStoreSkuBind(GetDB(), 100123, 30648)
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(storeSkuBind, false))
|
globals.SugarLogger.Debug(utils.Format4Output(storeSkuBind, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetStoreSkuPriceAndWeight(t *testing.T) {
|
||||||
|
storeSkuBind, err := GetStoreSkuPriceAndWeight(GetDB(), "11863739", model.VendorIDJD, []string{"2023508979"})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Debug(utils.Format4Output(storeSkuBind, false))
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func TestFormalizeStoreStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetStoreList4Role(t *testing.T) {
|
func TestGetStoreList4Role(t *testing.T) {
|
||||||
storeList, err := GetStoreList(GetDB(), nil, nil, "NiuBi")
|
storeList, err := GetStoreList(GetDB(), nil, nil, nil, nil, "NiuBi")
|
||||||
t.Log(utils.Format4Output(storeList, false))
|
t.Log(utils.Format4Output(storeList, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user