This commit is contained in:
苏尹岚
2021-03-25 17:30:24 +08:00
parent 735a35e97e
commit 964f13e2f1

View File

@@ -281,11 +281,11 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
sql := ` sql := `
SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, e.id store_id SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, e.id store_id
FROM sku_name a FROM sku_name a
JOIN sku b ON b.name_id = a.id AND b.status = ? AND b.deleted_at = ? JOIN sku b ON b.name_id = a.id AND b.deleted_at = ?
JOIN store e ON e.deleted_at = ? AND e.id = ? JOIN store e ON e.deleted_at = ? AND e.id = ?
` `
sqlParams = append(sqlParams, sqlParams = append(sqlParams,
model.SkuStatusNormal, utils.DefaultTimeValue, utils.DefaultTimeValue,
utils.DefaultTimeValue, storeID, utils.DefaultTimeValue, storeID,
) )
if !isFocus { if !isFocus {
@@ -341,12 +341,11 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
} }
sql += ` sql += `
WHERE a.deleted_at = ? WHERE a.deleted_at = ?
AND a.status = ?
AND (a.is_global = 1 OR f.id IS NOT NULL) AND (a.is_global = 1 OR f.id IS NOT NULL)
AND ((a.status = 1 AND b.status = 1) OR c.status = 1) AND ((a.status = 1 AND b.status = 1) OR c.status = 1)
` `
sqlParams = append(sqlParams, sqlParams = append(sqlParams,
utils.DefaultTimeValue, model.SkuStatusNormal, utils.DefaultTimeValue,
) )
if !isFocus { if !isFocus {
sql += " AND c.sku_id IS NULL" sql += " AND c.sku_id IS NULL"