Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.49 KB | None | 0 0
  1. STAMPS
  2.  
  3. Cluster id si priority man pe tabela STAMP (pzk)
  4.  
  5. CREATE TABLE `pizokel_catalog`.`stamp` (
  6.   `stamp_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  7.   `label_id` INT(11) UNSIGNED NOT NULL,
  8.   `cluster_id` INT(11) UNSIGNED DEFAULT NULL,
  9.   `priority` INT(11) UNSIGNED DEFAULT NULL,
  10.   `country` CHAR(2) NOT NULL,
  11.   `name` VARCHAR(64) DEFAULT NULL,
  12.   `color` VARCHAR(64) DEFAULT NULL,
  13.   `translation_key` VARCHAR(64) DEFAULT NULL,
  14.   PRIMARY KEY (`stamp_id`),
  15.   KEY `i_label_id` (`label_id`)
  16. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  17.  
  18. ADD INDEX UNIQUE - country + clusterId + priority
  19.  
  20. INSERT INTO `stamp` (`stamp_id`, `label_id`, `cluster_id`, `priority`, `country`, `name`, `color`, `translation_key`)
  21. VALUES
  22. (1, 1434, 1, 1, 'ro', 'auto_exclusive_ro', NULL, NULL),
  23. (2, 1435, 1, 1, 'bg', 'auto_exclusive_bg', NULL, NULL),
  24. (3, 1437, 1, 2, 'ro', 'auto_premium_ro', NULL, NULL),
  25. (4, 1439, 1, 2, 'hu', 'auto_premium_hu', NULL, NULL),
  26. (5, 1440, 2, 1, 'ro', 'auto_flash_ro', NULL, NULL),
  27. (6, 1441, 2, 1, 'bg', 'auto_flash_bg', NULL, NULL),
  28. (7, 1431, 2, 2, 'ro', 'auto_main_campaign_ro', NULL, NULL),
  29. (8, 1432, 2, 2, 'bg', 'auto_main_campaign_bg', NULL, NULL),
  30. (9, 1433, 2, 2, 'hu', 'auto_main_campaign_hu', NULL, NULL);
  31.  
  32.  
  33. > ETL GET stamps:
  34.  
  35. SELECT * FROM stamp s
  36. INNER JOIN product_label pl ON pl.label_id = s.label_id
  37. INNER JOIN
  38. (SELECT product_id, cluster_id, MIN(priority) AS maxPrio
  39. FROM stamp s1
  40. INNER JOIN product_label pl1 ON pl1.label_id = s1.label_id
  41. GROUP BY product_id, cluster_id
  42. -- AND pl1.product_id IN (select product_id from product where product_id > 2001672)
  43. ) AS mp ON mp.product_id = pl.product_id AND mp.cluster_id = s.cluster_id AND s.priority = mp.maxPrio;
  44.  
  45.  
  46. ETL stuff
  47. 13.05 estimation added custom attributes localised, the java definition
  48. 14.05 - query TO find applicable labels, java functionality implementation
  49.  
  50. FOR __stp output => it represents the cluster ids 1, 2, 3, IN ORDER -> json encoded array - {1431, 1432, 1433} OR WITHOUT string AND make sure the ORDER IS kept
  51.  
  52.  
  53. ------------------------
  54. Label cluster id si priority id vor fi sterse de pe tabela de label -> ajung pe STAMP, dar field-ul de $label de pe entitatea de Stamp ramane IN caz ca o sa avem nevoie  de label name
  55. PREPARE the queries TO remove the cluster_id AND priority COLUMNS FROM auto_config_label
  56. De editat:
  57.  
  58. template, color, label - cu dropdown, priority, cluster - Si mai vedem ce alte field-uri
  59.   + pt template - niste string uri de templates salvate IN db
  60. CRUD- also CREATE now
  61. Validari
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement