fix: refs #230926 item_getSimilar #3133
|
@ -24,6 +24,7 @@ BEGIN
|
||||||
|
|
||||||
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
||||||
|
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
|
@ -74,14 +75,13 @@ BEGIN
|
||||||
AND a.calc_id = vAvailableCalcFk
|
AND a.calc_id = vAvailableCalcFk
|
||||||
LEFT JOIN cache.visible v ON v.item_id = i.id
|
LEFT JOIN cache.visible v ON v.item_id = i.id
|
||||||
AND v.calc_id = vVisibleCalcFk
|
AND v.calc_id = vVisibleCalcFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||||
AND lb.warehouse_id = vWarehouseFk
|
|
||||||
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
||||||
AND ip.itemFk = vSelf
|
AND ip.itemFk = vSelf
|
||||||
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
||||||
AND it.priority = vPriority
|
AND it.priority = vPriority
|
||||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
LEFT JOIN vn.buy b ON b.id = bu.buyFk
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
|
@ -98,5 +98,7 @@ BEGIN
|
||||||
(i.tag8 = its.tag8) DESC,
|
(i.tag8 = its.tag8) DESC,
|
||||||
match8 DESC
|
match8 DESC
|
||||||
LIMIT 100;
|
LIMIT 100;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue