feat: refs #7168 Added vRecords param in proc
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-04-16 09:12:51 +02:00
parent 22006ea3fb
commit b1e8cdfd86
1 changed files with 37 additions and 26 deletions

View File

@ -1,14 +1,18 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(
vShelvingFk VARCHAR(10),
vRecords INT
)
BEGIN BEGIN
/** /**
* Devuelve el log de los item en cada carro * Devuelve el log de los item en cada carro
* *
* @param vShelvingFk Matrícula del carro * @param vShelvingFk Matrícula del carro
* @param vRecords Límite de registros retornados
* *
*/ */
DECLARE vQuery TEXT;
SET vQuery = '
SELECT isl.itemShelvingFk, SELECT isl.itemShelvingFk,
isl.created, isl.created,
isl.accion, isl.accion,
@ -17,7 +21,7 @@ BEGIN
isl.quantity, isl.quantity,
isl.visible, isl.visible,
isl.available, isl.available,
isl.grouping, isl.`grouping`,
isl.packing, isl.packing,
isl.stars, isl.stars,
item.longName, item.longName,
@ -28,8 +32,15 @@ BEGIN
FROM item FROM item
JOIN itemShelvingLog isl ON item.id = isl.itemFk JOIN itemShelvingLog isl ON item.id = isl.itemFk
JOIN worker ON isl.workerFk = worker.id JOIN worker ON isl.workerFk = worker.id
WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk WHERE shelvingFk = ?
ORDER BY isl.created DESC; OR isl.itemFk = ?
ORDER BY isl.created DESC';
IF vRecords IS NOT NULL THEN
SET vQuery = CONCAT(vQuery, '\nLIMIT ', vRecords);
END IF;
EXECUTE IMMEDIATE vQuery
USING vShelvingFk, vShelvingFk;
END$$ END$$
DELIMITER ; DELIMITER ;