This commit is contained in:
苏尹岚
2021-01-26 11:05:56 +08:00
parent 7aace1bf49
commit af15ad0e84
5 changed files with 2 additions and 123 deletions

View File

@@ -2740,7 +2740,3 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
}
return hint, err
}
func GetThingMap(ctx *jxcontext.Context, vendorOrgCode string) (getThingMapResult []*dao.GetThingMapCategoryResult, err error) {
return dao.GetThingMapCategory(dao.GetDB(), []int{model.VendorIDJD}, nil, []string{vendorOrgCode})
}

View File

@@ -28,38 +28,6 @@ func GetThingMapList(db *DaoDB, thingType int, vendorIDs, thingIDs []int, vendor
return cats, err
}
type GetThingMapCategoryResult struct {
model.ThingMap
Name string `orm:"size(255)" json:"name"`
ParentID int `orm:"column(parent_id)" json:"parentID"`
Level int8 `json:"level"`
Seq int `json:"seq"`
}
func GetThingMapCategory(db *DaoDB, vendorIDs, thingIDs []int, vendorOrgCodes []string) (cats []*GetThingMapCategoryResult, err error) {
sql := `
SELECT t1.*, t2.name, t2.parent_id, t2.level, t2.seq
FROM thing_map t1
JOIN sku_category t2 ON t2.id = t1.thing_id AND t2.deleted_at = ?
WHERE t1.deleted_at = ? AND t1.thing_type = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
utils.DefaultTimeValue,
model.ThingTypeCategory,
}
if len(thingIDs) > 0 {
sql += " AND t1.thing_id IN (" + GenQuestionMarks(len(thingIDs)) + ")"
sqlParams = append(sqlParams, thingIDs)
}
if len(vendorOrgCodes) > 0 {
sql += " AND t1.vendor_org_code IN (" + GenQuestionMarks(len(vendorOrgCodes)) + ")"
sqlParams = append(sqlParams, vendorOrgCodes)
}
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 {

View File

@@ -21,9 +21,6 @@ type ThingMap struct {
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
Remark string `orm:"size(255)" json:"remark"`
ThingName string `json:"thingName"`
ThingSeq int `json:"thingSeq"`
}
func (*ThingMap) TableUnique() [][]string {