2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_excludeFromGeo`(vZoneGeo INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Excluye zonas a partir un geoFk.
|
|
|
|
*
|
|
|
|
* @table tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, landed, shipped) The computed options
|
|
|
|
* @param vZoneGeo The zone geo
|
|
|
|
* @return tmp.zoneOption The computed options
|
|
|
|
*/
|
|
|
|
DELETE t
|
|
|
|
FROM tmp.zoneOption t
|
|
|
|
JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed
|
|
|
|
LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
|
|
|
|
JOIN zoneGeo zg1 ON zg1.id = eg.geoFk
|
|
|
|
JOIN zoneGeo zg2 ON zg2.id = vZoneGeo
|
|
|
|
WHERE zg2.`path` LIKE CONCAT(zg1.`path`, zg1.id,'/%')
|
|
|
|
OR zg2.id = zg1.id;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|