Ver código fonte

modify the triggers on table trade$goods: set v_data_id=cmp_id if cmp_uuid is not null

sunyj 8 anos atrás
pai
commit
904b7ad32c
1 arquivos alterados com 18 adições e 3 exclusões
  1. 18 3
      mall-search/init.sql

+ 18 - 3
mall-search/init.sql

@@ -284,7 +284,12 @@ CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_i` AFTER INSERT ON `trad
     declare v_data text default 'goId';
     declare v_data text default 'goId';
     declare v_priority int default 0;
     declare v_priority int default 0;
 
 
-    set v_data_id=new.go_id;
+    if new.cmp_uuid then
+      set v_data='cmpId';
+      select cmp_id into v_data_id from product$component where cmp_uuid=new.cmp_uuid;
+    else
+      set v_data_id=new.go_id;
+    end if;
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
 end
 end
 ;;
 ;;
@@ -302,7 +307,12 @@ CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_u` AFTER UPDATE ON `trad
     declare v_data text default 'goId';
     declare v_data text default 'goId';
     declare v_priority int default 0;
     declare v_priority int default 0;
 
 
-    set v_data_id=old.go_id;
+    if old.cmp_uuid then
+      set v_data='cmpId';
+      select cmp_id into v_data_id from product$component where cmp_uuid=old.cmp_uuid;
+    else
+      set v_data_id=old.go_id;
+    end if;
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
 end
 end
 ;;
 ;;
@@ -320,7 +330,12 @@ CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_d` AFTER DELETE ON `trad
     declare v_data text default 'goId';
     declare v_data text default 'goId';
     declare v_priority int default 0;
     declare v_priority int default 0;
 
 
-    set v_data_id=old.go_id;
+    if old.cmp_uuid then
+      set v_data='cmpId';
+      select cmp_id into v_data_id from product$component where cmp_uuid=old.cmp_uuid;
+    else
+      set v_data_id=old.go_id;
+    end if;
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
     call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
 end
 end
 ;;
 ;;