Merge pull request 'feat: refs #7681 Optimization and refactor' (!2707) from 7681-routeUpdateM3 into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2707 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
b72923f160
|
@ -1,14 +1,18 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(vRoute INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(
|
||||||
|
vSelf INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Actualiza el volumen de la ruta.
|
||||||
|
*
|
||||||
|
* @param vSelf Id ruta
|
||||||
|
*/
|
||||||
|
DECLARE vVolume DECIMAL(10,1)
|
||||||
|
DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf);
|
||||||
|
|
||||||
UPDATE vn.route r
|
UPDATE `route`
|
||||||
LEFT JOIN (
|
SET m3 = IFNULL(vVolume, 0)
|
||||||
SELECT routeFk, SUM(volume) AS m3
|
WHERE id = vSelf;
|
||||||
FROM saleVolume
|
|
||||||
WHERE routeFk = vRoute
|
|
||||||
) v ON v.routeFk = r.id
|
|
||||||
SET r.m3 = IFNULL(v.m3,0)
|
|
||||||
WHERE r.id =vRoute;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue