Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6021-fix-item_get
This commit is contained in:
commit
70c9bae710
|
@ -1,41 +1,21 @@
|
|||
DROP PROCEDURE IF EXISTS floranet.order_put;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vOrder JSON)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vJsonData JSON)
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Get and process an order.
|
||||
*
|
||||
* @param vOrder Data of the order
|
||||
*
|
||||
* Customer data: <customerName>, <email>, <customerPhone>
|
||||
*
|
||||
* Item data: <catalogueFk>, <message>
|
||||
*
|
||||
* Delivery data: <deliveryName>, <address>, <deliveryPhone>
|
||||
*
|
||||
* @param vJsonData The order data in json format
|
||||
*/
|
||||
INSERT IGNORE INTO `order`(
|
||||
catalogueFk,
|
||||
customerName,
|
||||
email,
|
||||
customerPhone,
|
||||
message,
|
||||
deliveryName,
|
||||
address,
|
||||
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'))
|
||||
);
|
||||
INSERT INTO `order`
|
||||
SET catalogueFk = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.products[0].id')),
|
||||
customerName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.customerName')),
|
||||
email = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.email')),
|
||||
customerPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.customerPhone')),
|
||||
message= JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.message')),
|
||||
deliveryName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryName')),
|
||||
address = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.address')),
|
||||
deliveryPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryPhone'));
|
||||
|
||||
SELECT LAST_INSERT_ID() orderFk;
|
||||
END$$
|
||||
|
|
Loading…
Reference in New Issue