aa
This commit is contained in:
@@ -302,10 +302,8 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
|
|||||||
sqlParams = append(sqlParams, status)
|
sqlParams = append(sqlParams, status)
|
||||||
}
|
}
|
||||||
sql += `
|
sql += `
|
||||||
LEFT JOIN sku_category d ON d.id = a.category_id AND d.deleted_at = ?
|
|
||||||
LEFT JOIN sku_name_place_bind f ON a.id = f.name_id AND e.city_code = f.place_code
|
LEFT JOIN sku_name_place_bind f ON a.id = f.name_id AND e.city_code = f.place_code
|
||||||
`
|
`
|
||||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
|
||||||
if isAct {
|
if isAct {
|
||||||
sql += `
|
sql += `
|
||||||
JOIN (
|
JOIN (
|
||||||
@@ -342,8 +340,17 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
|
|||||||
`
|
`
|
||||||
sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.Bool2Int(isFocus), storeID)
|
sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.Bool2Int(isFocus), storeID)
|
||||||
if categoryID != 0 {
|
if categoryID != 0 {
|
||||||
sql += " AND d.id = ?"
|
cat := &model.SkuCategory{}
|
||||||
sqlParams = append(sqlParams, categoryID)
|
cat.ID = categoryID
|
||||||
|
if err = dao.GetEntity(db, cat); err == nil {
|
||||||
|
sql += " AND (a.category_id = ?"
|
||||||
|
sqlParams = append(sqlParams, cat.ID)
|
||||||
|
if cat.Level == 1 {
|
||||||
|
sql += " OR a.category_id IN (SELECT id FROM sku_category WHERE parent_id = ?)"
|
||||||
|
sqlParams = append(sqlParams, cat.ID)
|
||||||
|
}
|
||||||
|
sql += ")"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if isFocus {
|
if isFocus {
|
||||||
sql += " AND ((a.status = ? AND b.status = ?) OR c.status = ?)"
|
sql += " AND ((a.status = ? AND b.status = ?) OR c.status = ?)"
|
||||||
|
|||||||
Reference in New Issue
Block a user