This commit is contained in:
邹宗楠
2022-10-27 15:07:09 +08:00
parent 8f42a925a9
commit 5a4fe56de7
3 changed files with 72 additions and 33 deletions

View File

@@ -27,6 +27,37 @@ func GetThingMapList(db *DaoDB, thingType int, vendorIDs, thingIDs []int, vendor
return cats, err
}
func CreateThingMap(thingId int64, vendorThingID, appOrgCode, skuAttrId string) error {
thingMap := &model.ThingMap{
ThingID: thingId,
ThingType: model.ThingTypeSku,
VendorID: model.VendorIDDD,
VendorOrgCode: appOrgCode,
VendorThingID: vendorThingID,
Remark: skuAttrId,
SyncStatus: 0,
}
WrapAddIDCULDEntity(thingMap, "jxadmin")
return CreateEntity(GetDB(), thingMap)
}
// GetThingToTiktokMapList 抖店获取同步类型
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64) (cats []*model.ThingMap, err error) {
sql := `
SELECT t1.*
FROM thing_map t1
WHERE thing_id = ? AND vendor_id = ? t1.deleted_at = ?
`
sqlParams := []interface{}{
vendorId, thingId,
utils.DefaultTimeValue,
}
err = GetRows(db, &cats, sql, sqlParams...)
return cats, err
}
func GetThingMapMap(db *DaoDB, thingType int, vendorIDs, thingIDs []int) (thingMapMap map[int64][]*model.ThingMap, err error) {
thingMapList, err := GetThingMapList(db, thingType, vendorIDs, thingIDs, nil)
if err == nil {