Merge branch 'dev' into 6021-fix-item_get
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Pako Natek 2024-04-16 15:56:15 +00:00
commit 2b39d3fa15
1 changed files with 11 additions and 31 deletions

View File

@ -1,41 +1,21 @@
DROP PROCEDURE IF EXISTS floranet.order_put;
DELIMITER $$ DELIMITER $$
$$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vJsonData JSON)
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vOrder JSON)
READS SQL DATA READS SQL DATA
BEGIN BEGIN
/** /**
* Get and process an order. * Get and process an order.
* *
* @param vOrder Data of the order * @param vJsonData The order data in json format
*
* Customer data: <customerName>, <email>, <customerPhone>
*
* Item data: <catalogueFk>, <message>
*
* Delivery data: <deliveryName>, <address>, <deliveryPhone>
*
*/ */
INSERT IGNORE INTO `order`( INSERT INTO `order`
catalogueFk, SET catalogueFk = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.products[0].id')),
customerName, customerName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.customerName')),
email, email = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.email')),
customerPhone, customerPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.customerPhone')),
message, message= JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.message')),
deliveryName, deliveryName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryName')),
address, address = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.address')),
deliveryPhone deliveryPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryPhone'));
)
VALUES (JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.catalogueFk')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerName')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.email')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerPhone')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.message')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryName')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.address')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryPhone'))
);
SELECT LAST_INSERT_ID() orderFk; SELECT LAST_INSERT_ID() orderFk;
END$$ END$$