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

24 lines
1.1 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-05-23 19:38:02 +00:00
REPLACE `order`
2024-04-16 15:42:36 +00:00
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')),
2024-05-23 19:38:02 +00:00
deliveryPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryPhone')),
observations = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.observations'));
2024-02-15 12:13:22 +00:00
SELECT LAST_INSERT_ID() orderFk;
END$$
DELIMITER ;