salix/db/routines/floranet/procedures/order_put.sql

23 lines
1.0 KiB
MySQL
Raw Normal View History

2024-02-15 12:13:22 +00:00
DELIMITER $$
2024-04-16 15:42:36 +00:00
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vJsonData JSON)
2024-02-15 12:13:22 +00:00
READS SQL DATA
BEGIN
/**
2024-04-11 11:25:43 +00:00
* Get and process an order.
2024-02-15 12:13:22 +00:00
*
2024-04-16 15:42:36 +00:00
* @param vJsonData The order data in json format
2024-02-15 12:13:22 +00:00
*/
2024-04-16 15:42:36 +00:00
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'));
2024-02-15 12:13:22 +00:00
SELECT LAST_INSERT_ID() orderFk;
END$$
DELIMITER ;