- fixed bug in GetStoreVendorMaps
This commit is contained in:
@@ -239,7 +239,7 @@ func CreateStore(store *model.Store, userName string) (id int, err error) {
|
||||
}
|
||||
|
||||
func SyncStore2Vendor(db *dao.DaoDB, vendorID int, store *model.Store, isForce bool, userName string) (err error) {
|
||||
storeMaps, err := GetStoreVendorMaps(db, store.ID)
|
||||
storeMaps, err := GetStoreVendorMaps(db, store.ID, -1)
|
||||
if err == nil {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(store, false))
|
||||
for _, storeMap := range storeMaps {
|
||||
@@ -254,8 +254,12 @@ func SyncStore2Vendor(db *dao.DaoDB, vendorID int, store *model.Store, isForce b
|
||||
return err
|
||||
}
|
||||
|
||||
func GetStoreVendorMaps(db *dao.DaoDB, storeID int) (storeMaps []*model.StoreMap, err error) {
|
||||
err = dao.GetRows(db, &storeMaps, "SELECT * FROM store_map WHERE store_id = ?", storeID)
|
||||
func GetStoreVendorMaps(db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*model.StoreMap, err error) {
|
||||
if vendorID == -1 {
|
||||
err = dao.GetRows(db, &storeMaps, "SELECT * FROM store_map WHERE store_id = ?", storeID)
|
||||
} else {
|
||||
err = dao.GetRows(db, &storeMaps, "SELECT * FROM store_map WHERE store_id = ? AND vendor_id = ?", storeID, vendorID)
|
||||
}
|
||||
return storeMaps, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user