27 lines
1.0 KiB
MySQL
27 lines
1.0 KiB
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterInsert`
|
||
|
AFTER INSERT ON `collectionVolumetry`
|
||
|
FOR EACH ROW
|
||
|
BEGIN
|
||
|
DECLARE vJSON JSON DEFAULT JSON_OBJECT();
|
||
|
DECLARE vUserFk INT DEFAULT account.myUser_getId();
|
||
|
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('id', NEW.id), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('level', NEW.level), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('lines', NEW.lines), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('liters', NEW.liters), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('height', NEW.height), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', NEW.itemPackingTypeFk), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', NEW.trainFk), vJSON);
|
||
|
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
|
||
|
SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'insert'), vJSON);
|
||
|
|
||
|
SET vJSON = util.notification_send(
|
||
|
'modified-collection-volumetry',
|
||
|
JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
|
||
|
vUserFk
|
||
|
);
|
||
|
END$$
|
||
|
DELIMITER ;
|