|
|
|
@ -11740,6 +11740,417 @@ DELIMITER ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Current Database: `floranet`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `floranet` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */;
|
|
|
|
|
|
|
|
|
|
USE `floranet`;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Table structure for table `addressPostCode`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `addressPostCode`;
|
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
|
|
|
CREATE TABLE `addressPostCode` (
|
|
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
|
`addressFk` int(11) NOT NULL,
|
|
|
|
|
`postCode` varchar(30) NOT NULL,
|
|
|
|
|
`hoursInAdvance` int(10) unsigned NOT NULL DEFAULT 24,
|
|
|
|
|
`dayOfWeek` int(10) unsigned NOT NULL,
|
|
|
|
|
`deliveryCost` decimal(10,2) NOT NULL DEFAULT 0.00,
|
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
|
UNIQUE KEY `addressPostCode_unique` (`postCode`,`addressFk`,`dayOfWeek`),
|
|
|
|
|
KEY `addressPostCode_address_FK` (`addressFk`),
|
|
|
|
|
CONSTRAINT `addressPostCode_address_FK` FOREIGN KEY (`addressFk`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Client''s address registered for floranet network';
|
|
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Table structure for table `builder`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `builder`;
|
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
|
|
|
CREATE TABLE `builder` (
|
|
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
`itemFk` int(11) NOT NULL,
|
|
|
|
|
`elementFk` int(11) NOT NULL,
|
|
|
|
|
`quantity` int(10) unsigned NOT NULL DEFAULT 1,
|
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
|
KEY `builder_FK` (`itemFk`),
|
|
|
|
|
KEY `builder_FK_1` (`elementFk`),
|
|
|
|
|
CONSTRAINT `builder_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
|
CONSTRAINT `builder_FK_1` FOREIGN KEY (`elementFk`) REFERENCES `element` (`itemFk`) ON UPDATE CASCADE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements';
|
|
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Table structure for table `catalogue`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `catalogue`;
|
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
|
|
|
CREATE TABLE `catalogue` (
|
|
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
`name` varchar(50) DEFAULT NULL,
|
|
|
|
|
`price` decimal(10,2) NOT NULL,
|
|
|
|
|
`itemFk` int(11) NOT NULL,
|
|
|
|
|
`dated` date DEFAULT NULL,
|
|
|
|
|
`postalCode` varchar(12) DEFAULT NULL,
|
|
|
|
|
`type` varchar(50) DEFAULT NULL,
|
|
|
|
|
`image` varchar(255) DEFAULT NULL,
|
|
|
|
|
`description` text DEFAULT NULL,
|
|
|
|
|
`created` timestamp NULL DEFAULT current_timestamp(),
|
|
|
|
|
`payed` datetime DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
|
KEY `itemFk` (`itemFk`),
|
|
|
|
|
CONSTRAINT `catalogue_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Table structure for table `element`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `element`;
|
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
|
|
|
CREATE TABLE `element` (
|
|
|
|
|
`itemFk` int(11) NOT NULL,
|
|
|
|
|
`typeFk` smallint(5) unsigned DEFAULT NULL,
|
|
|
|
|
`size` int(11) DEFAULT NULL,
|
|
|
|
|
`inkFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
|
|
|
|
`originFk` tinyint(2) unsigned DEFAULT NULL,
|
|
|
|
|
`name` varchar(30) DEFAULT NULL,
|
|
|
|
|
`quantity` int(11) NOT NULL DEFAULT 1,
|
|
|
|
|
PRIMARY KEY (`itemFk`),
|
|
|
|
|
KEY `element_FK` (`itemFk`),
|
|
|
|
|
KEY `element_FK_1` (`typeFk`),
|
|
|
|
|
KEY `element_FK_2` (`inkFk`),
|
|
|
|
|
KEY `element_FK_3` (`originFk`),
|
|
|
|
|
CONSTRAINT `element_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
|
CONSTRAINT `element_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
|
CONSTRAINT `element_FK_2` FOREIGN KEY (`inkFk`) REFERENCES `vn`.`ink` (`id`) ON UPDATE CASCADE,
|
|
|
|
|
CONSTRAINT `element_FK_3` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON UPDATE CASCADE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Filtro para localizar posibles items que coincidan con la descripción';
|
|
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Table structure for table `order`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `order`;
|
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
|
|
|
CREATE TABLE `order` (
|
|
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
`catalogueFk` int(11) DEFAULT NULL,
|
|
|
|
|
`customerName` varchar(100) DEFAULT NULL,
|
|
|
|
|
`email` varchar(100) DEFAULT NULL,
|
|
|
|
|
`customerPhone` varchar(15) DEFAULT NULL,
|
|
|
|
|
`message` varchar(255) DEFAULT NULL,
|
|
|
|
|
`deliveryName` varchar(100) DEFAULT NULL,
|
|
|
|
|
`address` varchar(200) DEFAULT NULL,
|
|
|
|
|
`deliveryPhone` varchar(100) DEFAULT NULL,
|
|
|
|
|
`isPaid` tinyint(1) NOT NULL DEFAULT 0,
|
|
|
|
|
`payed` datetime DEFAULT NULL,
|
|
|
|
|
`created` timestamp NULL DEFAULT current_timestamp(),
|
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
|
UNIQUE KEY `catalogueFk` (`catalogueFk`),
|
|
|
|
|
CONSTRAINT `order_ibfk_1` FOREIGN KEY (`catalogueFk`) REFERENCES `catalogue` (`id`) ON UPDATE CASCADE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Dumping events for database 'floranet'
|
|
|
|
|
--
|
|
|
|
|
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
|
|
|
|
|
/*!50106 DROP EVENT IF EXISTS `clean` */;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
|
|
|
|
|
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
|
|
|
|
|
/*!50003 SET time_zone = 'SYSTEM' */ ;;
|
|
|
|
|
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clean` ON SCHEDULE EVERY 1 DAY STARTS '2024-01-01 23:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
|
|
|
|
|
DELETE
|
|
|
|
|
FROM `order`
|
|
|
|
|
WHERE created < CURDATE()
|
|
|
|
|
AND isPaid = FALSE;
|
|
|
|
|
|
|
|
|
|
DELETE c.*
|
|
|
|
|
FROM catalogue c
|
|
|
|
|
LEFT JOIN `order` o ON o.catalogueFk = c.id
|
|
|
|
|
WHERE c.created < CURDATE()
|
|
|
|
|
AND o.id IS NULL;
|
|
|
|
|
END */ ;;
|
|
|
|
|
/*!50003 SET time_zone = @saved_time_zone */ ;;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Dumping routines for database 'floranet'
|
|
|
|
|
--
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `catalogue_get` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `catalogue_get`(vLanded DATE, vPostalCode VARCHAR(15))
|
|
|
|
|
READS SQL DATA
|
|
|
|
|
BEGIN
|
|
|
|
|
/**
|
|
|
|
|
* Returns list, price and all the stuff regarding the floranet items
|
|
|
|
|
*
|
|
|
|
|
* @param vLanded Delivery date
|
|
|
|
|
* @param vPostalCode Delivery address postal code
|
|
|
|
|
*/
|
|
|
|
|
DECLARE vLastCatalogueFk INT;
|
|
|
|
|
|
|
|
|
|
START TRANSACTION;
|
|
|
|
|
|
|
|
|
|
SELECT * FROM catalogue FOR UPDATE;
|
|
|
|
|
|
|
|
|
|
SELECT MAX(id) INTO vLastCatalogueFk
|
|
|
|
|
FROM catalogue;
|
|
|
|
|
|
|
|
|
|
INSERT INTO catalogue(
|
|
|
|
|
name,
|
|
|
|
|
price,
|
|
|
|
|
itemFk,
|
|
|
|
|
dated,
|
|
|
|
|
postalCode,
|
|
|
|
|
`type`,
|
|
|
|
|
image,
|
|
|
|
|
description
|
|
|
|
|
)
|
|
|
|
|
SELECT i.name,
|
|
|
|
|
i.`size`,
|
|
|
|
|
i.id,
|
|
|
|
|
vLanded,
|
|
|
|
|
vPostalCode,
|
|
|
|
|
it.name,
|
|
|
|
|
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
|
|
|
|
|
i.description
|
|
|
|
|
FROM vn.item i
|
|
|
|
|
JOIN vn.itemType it ON it.id = i.typeFk
|
|
|
|
|
WHERE it.code IN ('FNR','FNP');
|
|
|
|
|
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM catalogue
|
|
|
|
|
WHERE id > IFNULL(vLastCatalogueFk,0);
|
|
|
|
|
|
|
|
|
|
COMMIT;
|
|
|
|
|
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `contact_request` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `contact_request`(
|
|
|
|
|
vName VARCHAR(100),
|
|
|
|
|
vPhone VARCHAR(15),
|
|
|
|
|
vEmail VARCHAR(100),
|
|
|
|
|
vMessage TEXT)
|
|
|
|
|
READS SQL DATA
|
|
|
|
|
BEGIN
|
|
|
|
|
/**
|
|
|
|
|
* Set actions for contact request.
|
|
|
|
|
*
|
|
|
|
|
* @param vPostalCode Delivery address postal code
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `deliveryDate_get` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `deliveryDate_get`(vPostalCode VARCHAR(15))
|
|
|
|
|
READS SQL DATA
|
|
|
|
|
BEGIN
|
|
|
|
|
/**
|
|
|
|
|
* Returns available dates for this postalCode, in the next seven days
|
|
|
|
|
*
|
|
|
|
|
* @param vPostalCode Delivery address postal code
|
|
|
|
|
*/
|
|
|
|
|
DECLARE vCurrentDayOfWeek INT;
|
|
|
|
|
|
|
|
|
|
SET vCurrentDayOfWeek = DAYOFWEEK(NOW());
|
|
|
|
|
|
|
|
|
|
SELECT DISTINCT nextDay
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT CURDATE() + INTERVAL IF(
|
|
|
|
|
apc.dayOfWeek >= vCurrentDayOfWeek,
|
|
|
|
|
apc.dayOfWeek - vCurrentDayOfWeek,
|
|
|
|
|
7 - apc.dayOfWeek
|
|
|
|
|
) DAY nextDay,
|
|
|
|
|
NOW() + INTERVAL apc.hoursInAdvance - 12 HOUR minDeliveryTime
|
|
|
|
|
FROM addressPostCode apc
|
|
|
|
|
WHERE apc.postCode = vPostalCode
|
|
|
|
|
HAVING nextDay > minDeliveryTime) sub;
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `order_confirm` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirm`(vCatalogueFk INT)
|
|
|
|
|
READS SQL DATA
|
|
|
|
|
BEGIN
|
|
|
|
|
/** Update order.isPaid field
|
|
|
|
|
*
|
|
|
|
|
* @param vCatalogueFk floranet.catalogue.id
|
|
|
|
|
*
|
|
|
|
|
* @returns floranet.order.isPaid
|
|
|
|
|
*/
|
|
|
|
|
UPDATE `order`
|
|
|
|
|
SET isPaid = TRUE,
|
|
|
|
|
payed = NOW()
|
|
|
|
|
WHERE catalogueFk = vCatalogueFk;
|
|
|
|
|
|
|
|
|
|
SELECT isPaid
|
|
|
|
|
FROM `order`
|
|
|
|
|
WHERE catalogueFk = vCatalogueFk;
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `order_put` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `order_put`(vOrder 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>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
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'))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
SELECT LAST_INSERT_ID() orderFk;
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
|
|
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
|
|
|
/*!50003 DROP PROCEDURE IF EXISTS `sliders_get` */;
|
|
|
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
|
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
|
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
|
|
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
|
|
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
|
|
|
DELIMITER ;;
|
|
|
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `sliders_get`()
|
|
|
|
|
READS SQL DATA
|
|
|
|
|
BEGIN
|
|
|
|
|
/**
|
|
|
|
|
* Returns list of url for sliders
|
|
|
|
|
*/
|
|
|
|
|
SELECT
|
|
|
|
|
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url,
|
|
|
|
|
i.longName
|
|
|
|
|
FROM vn.item i
|
|
|
|
|
JOIN vn.itemType it ON it.id = i.typeFk
|
|
|
|
|
WHERE it.code IN ('FNR','FNP');
|
|
|
|
|
|
|
|
|
|
END ;;
|
|
|
|
|
DELIMITER ;
|
|
|
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
|
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
|
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
|
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Current Database: `hedera`
|
|
|
|
|
--
|
|
|
|
@ -86045,6 +86456,12 @@ USE `edi`;
|
|
|
|
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
|
|
|
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Current Database: `floranet`
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
USE `floranet`;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Current Database: `hedera`
|
|
|
|
|
--
|
|
|
|
@ -91244,4 +91661,4 @@ USE `vn2008`;
|
|
|
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
|
|
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
|
|
|
|
|
|
|
|
-- Dump completed on 2024-04-05 7:59:52
|
|
|
|
|
-- Dump completed on 2024-04-08 7:13:58
|
|
|
|
|