- sku category.
This commit is contained in:
@@ -237,10 +237,13 @@ 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) {
|
||||
var (
|
||||
storeMaps []*model.StoreMap
|
||||
)
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
storeMaps, err := GetStoreVendorMaps(db, store.ID, -1)
|
||||
err = dao.GetEntities(db, &storeMaps, utils.Params2Map("StoreID", store.ID), true)
|
||||
if err == nil {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(store, false))
|
||||
copiedStore := *store
|
||||
@@ -258,12 +261,13 @@ func SyncStore2Vendor(db *dao.DaoDB, vendorID int, store *model.Store, isForce b
|
||||
}
|
||||
|
||||
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)
|
||||
cond := map[string]interface{}{
|
||||
"StoreID": storeID,
|
||||
}
|
||||
return storeMaps, err
|
||||
if vendorID != -1 {
|
||||
cond["VendorID"] = vendorID
|
||||
}
|
||||
return storeMaps, dao.GetEntities(db, &storeMaps, cond, false)
|
||||
}
|
||||
|
||||
func AddStoreVendorMap(db *dao.DaoDB, storeMap *model.StoreMap, userName string) (outStoreMap *model.StoreMap, err error) {
|
||||
@@ -281,7 +285,7 @@ func AddStoreVendorMap(db *dao.DaoDB, storeMap *model.StoreMap, userName string)
|
||||
|
||||
func DeleteStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, userName string) (num int64, err error) {
|
||||
storeMap := &model.StoreMap{}
|
||||
return dao.DeleteEntity(db, storeMap, utils.Params2Map("StoreID", storeID, "VendorID", vendorID))
|
||||
return dao.DeleteEntity(db, storeMap, utils.Params2Map("StoreID", storeID, "VendorID", vendorID), "")
|
||||
}
|
||||
|
||||
func UpdateStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, payload map[string]interface{}, userName string) (num int64, err error) {
|
||||
|
||||
Reference in New Issue
Block a user