aa
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/aliupcapi"
|
||||
@@ -199,6 +198,7 @@ func GetSkuByCats(db *DaoDB, catIDs []int) (skuList []*model.Sku, err error) {
|
||||
|
||||
// 多门店平台使用,当前只有京东
|
||||
func GetSkuCategoryWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, parentCatID int, catIDs []int, mustDirty bool) (catList []*SkuStoreCatInfo, err error) {
|
||||
sqlParams := []interface{}{}
|
||||
sql := `
|
||||
SELECT
|
||||
t1m.vendor_id, t1m.vendor_org_code,
|
||||
@@ -217,15 +217,25 @@ func GetSkuCategoryWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string,
|
||||
t1pm.sync_status parent_cat_sync_status
|
||||
FROM sku_category t1
|
||||
LEFT JOIN thing_map t1m ON t1m.thing_id = t1.id AND t1m.thing_type = ? AND t1m.deleted_at = ?
|
||||
`
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND t1m.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if len(appOrgCodes) > 0 {
|
||||
sql += " AND t1m.vendor_org_code IN (" + GenQuestionMarks(len(appOrgCodes)) + ")"
|
||||
sqlParams = append(sqlParams, appOrgCodes)
|
||||
}
|
||||
sql += `
|
||||
LEFT JOIN vendor_org_code a ON a.vendor_org_code = t1m.vendor_org_code AND a.vendor_id = t1m.vendor_id AND a.deleted_at = ?
|
||||
LEFT JOIN vendor_category_map b ON b.vendor_org_code = t1m.vendor_org_code AND b.vendor_id = t1m.vendor_id AND b.category_id = t1m.thing_id AND b.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
sqlParams = append(sqlParams,
|
||||
model.ThingTypeCategory,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
)
|
||||
sql += `
|
||||
LEFT JOIN sku_category t1p ON t1p.id = t1.parent_id
|
||||
LEFT JOIN thing_map t1pm ON t1pm.thing_id = t1p.id AND t1pm.thing_type = ? AND t1m.deleted_at = ?
|
||||
@@ -249,17 +259,7 @@ func GetSkuCategoryWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string,
|
||||
sql += " AND t1.parent_id = ?"
|
||||
sqlParams = append(sqlParams, parentCatID)
|
||||
}
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND t1m.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if len(appOrgCodes) > 0 {
|
||||
sql += " AND t1m.vendor_org_code IN (" + GenQuestionMarks(len(appOrgCodes)) + ")"
|
||||
sqlParams = append(sqlParams, appOrgCodes)
|
||||
}
|
||||
sql += " ORDER BY t1.seq"
|
||||
fmt.Println(sql)
|
||||
fmt.Println(sqlParams)
|
||||
err = GetRows(db, &catList, sql, sqlParams...)
|
||||
return catList, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user