123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992 |
- -- 创建消息表
- drop table if exists lucene$message;
- create table lucene$message(
- me_id bigint not null primary key auto_increment,
- me_table_name varchar(64) not null,
- me_method_type varchar(6) not null,
- me_data_id int not null,
- me_data text,
- me_priority int default 0,
- me_retry_count int default 0,
- me_create_time datetime not null
- );
- -- 创建消息历史表
- drop table if exists lucene$message_history;
- create table lucene$message_history(
- mh_id bigint not null primary key auto_increment,
- mh_dequeue_time datetime not null,
- me_id bigint not null,
- me_table_name varchar(64) not null,
- me_method_type varchar(6) not null,
- me_data_id int not null,
- me_data text,
- me_priority int default 0,
- me_create_time datetime not null
- );
- -- 创建存储过程 入队消息
- drop procedure if exists enqueue_lucene_message;
- delimiter $$
- create procedure enqueue_lucene_message(in v_table_name varchar(64), v_method_type varchar(6), v_data_id int, v_data text, v_priority int)
- begin
- insert into lucene$message (me_table_name, me_method_type, me_data_id, me_data, me_priority, me_create_time) values(v_table_name, v_method_type, v_data_id, v_data, v_priority, sysdate());
- end;$$
- delimiter ;
- -- 创建存储过程 出队消息
- drop procedure if exists dequeue_lucene_message;
- delimiter $$
- create procedure dequeue_lucene_message(in v_id bigint)
- begin
- insert into lucene$message_history (mh_dequeue_time, me_id, me_table_name, me_method_type, me_data_id, me_data, me_priority, me_create_time) select sysdate(), me_id, me_table_name, me_method_type, me_data_id, me_data, me_priority, me_create_time from lucene$message where me_id = v_id;
- delete from lucene$message where me_id = v_id;
- end;$$
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$brand
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_brand_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_brand_i` AFTER INSERT ON `product$brand` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$brand';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.br_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$brand
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_brand_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_brand_u` AFTER UPDATE ON `product$brand` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$brand';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.br_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$brand
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_brand_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_brand_d` AFTER DELETE ON `product$brand` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$brand';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.br_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$component
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_component_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_component_i` AFTER INSERT ON `product$component` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=new.cmp_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- set v_table_name='v$product$cmpgoods';
- set v_data='cmpId';
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$component
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_component_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_component_u` AFTER UPDATE ON `product$component` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=old.cmp_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- set v_table_name='v$product$cmpgoods';
- set v_data='cmpId';
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$component
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_component_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_component_d` AFTER DELETE ON `product$component` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=old.cmp_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- set v_table_name='v$product$cmpgoods';
- set v_data='cmpId';
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$kind
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_kind_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_kind_i` AFTER INSERT ON `product$kind` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$kind';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.ki_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$kind
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_kind_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_kind_u` AFTER UPDATE ON `product$kind` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$kind';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.ki_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$kind
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_kind_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_kind_d` AFTER DELETE ON `product$kind` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$kind';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.ki_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$propertyvalue
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_propertyvalue_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_propertyvalue_i` AFTER INSERT ON `product$propertyvalue` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=new.pv_componentid;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$propertyvalue
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_propertyvalue_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_propertyvalue_u` AFTER UPDATE ON `product$propertyvalue` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=old.pv_componentid;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$propertyvalue
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_propertyvalue_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_propertyvalue_d` AFTER DELETE ON `product$propertyvalue` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'product$component';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 0;
- set v_data_id=old.pv_componentid;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$pcb
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_pcb_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_pcb_i` AFTER INSERT ON `product$pcb` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'pcb_goods';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default 'pcbId';
- declare v_priority int default 0;
- set v_data_id=new.pcb_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$pcb
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_pcb_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_pcb_u` AFTER UPDATE ON `product$pcb` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'pcb_goods';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default 'pcbId';
- declare v_priority int default 0;
- set v_data_id=old.pcb_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$pcb
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_pcb_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_pcb_d` AFTER DELETE ON `product$pcb` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'pcb_goods';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default 'pcbId';
- declare v_priority int default 0;
- set v_data_id=old.pcb_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$goods
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_trade_goods_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_i` AFTER INSERT ON `trade$goods` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$cmpgoods';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default 'goId';
- declare v_priority int default 1;
- if new.cmp_uuid is not null then
- set v_data='cmpId';
- select cmp_id into v_data_id from product$component where cmp_uuid=new.cmp_uuid;
- if v_data_id is null then
- set v_data=concat('cmp_uuid 没有关联的器件:', new.cmp_uuid);
- set v_data_id=new.go_id;
- end if;
- 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);
- set v_table_name='pcb_goods';
- if new.go_productid is not null then
- set v_data='pcbId';
- set v_data_id = null;
- select pcb_id into v_data_id from product$pcb where pcb_productid=new.go_productid;
- if v_data_id is null then
- set v_data=concat('go_productid 没有关联的 PCB:', new.go_productid);
- set v_data_id=new.go_id;
- end if;
- 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);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$goods
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_trade_goods_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_u` AFTER UPDATE ON `trade$goods` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$cmpgoods';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default 'goId';
- declare v_priority int default 0;
- if old.cmp_uuid is not null then
- set v_data='cmpId';
- select cmp_id into v_data_id from product$component where cmp_uuid=old.cmp_uuid;
- if v_data_id is null then
- set v_data=concat('cmp_uuid 没有关联的器件:', old.cmp_uuid);
- set v_data_id=old.go_id;
- end if;
- 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);
- set v_table_name='pcb_goods';
- if old.go_productid is not null then
- set v_data='pcbId';
- set v_data_id = null;
- select pcb_id into v_data_id from product$pcb where pcb_productid=old.go_productid;
- if v_data_id is null then
- set v_data=concat('go_productid 没有关联的 PCB:', old.go_productid);
- set v_data_id=old.go_id;
- end if;
- 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);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$goods
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_trade_goods_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_trade_goods_d` AFTER DELETE ON `trade$goods` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$cmpgoods';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default 'goId';
- declare v_priority int default 0;
- if old.cmp_uuid is not null then
- set v_data='cmpId';
- select cmp_id into v_data_id from product$component where cmp_uuid=old.cmp_uuid;
- if v_data_id is null then
- set v_data=concat('cmp_uuid 没有关联的器件:', old.cmp_uuid);
- set v_data_id=old.go_id;
- end if;
- 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);
- set v_table_name='pcb_goods';
- if old.go_productid is not null then
- set v_data='pcbId';
- set v_data_id = null;
- select pcb_id into v_data_id from product$pcb where pcb_productid=old.go_productid;
- if v_data_id is null then
- set v_data=concat('go_productid 没有关联的 PCB:', old.go_productid);
- set v_data_id=old.go_id;
- end if;
- 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);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_i` AFTER INSERT ON `trade$invoice_fmor` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_u` AFTER UPDATE ON `trade$invoice_fmor` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_d` AFTER DELETE ON `trade$invoice_fmor` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_dt_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_dt_i` AFTER INSERT ON `trade$invoice_fmor_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_dt_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_dt_u` AFTER UPDATE ON `trade$invoice_fmor_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmor_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_inv_dt_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_inv_dt_d` AFTER DELETE ON `trade$invoice_fmor_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmor';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_i` AFTER INSERT ON `trade$invoice_fmpu` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_u` AFTER UPDATE ON `trade$invoice_fmpu` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_d` AFTER DELETE ON `trade$invoice_fmpu` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_dt_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_dt_i` AFTER INSERT ON `trade$invoice_fmpu_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_dt_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_dt_u` AFTER UPDATE ON `trade$invoice_fmpu_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$invoice_fmpu_dt
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_inv_dt_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_inv_dt_d` AFTER DELETE ON `trade$invoice_fmpu_dt` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$invoice_fmpu';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.invoice_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_i` AFTER INSERT ON `trade$order` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_u` AFTER UPDATE ON `trade$order` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_d` AFTER DELETE ON `trade$order` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_dt_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_dt_i` AFTER INSERT ON `trade$order_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.order_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_dt_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_dt_u` AFTER UPDATE ON `trade$order_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.order_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$order_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_order_dt_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_order_dt_d` AFTER DELETE ON `trade$order_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$order';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.order_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_i` AFTER INSERT ON `trade$purchase` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_u` AFTER UPDATE ON `trade$purchase` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_d` AFTER DELETE ON `trade$purchase` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_dt_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_dt_i` AFTER INSERT ON `trade$purchase_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.purchase_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_dt_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_dt_u` AFTER UPDATE ON `trade$purchase_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.purchase_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table trade$purchase_detail
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_purchase_dt_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_purchase_dt_d` AFTER DELETE ON `trade$purchase_detail` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'trade$purchase';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.purchase_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- 2018年5月22日 20:01:19 dongbw
- -- ----------------------------
- -- Triggers structure for table v$product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_i` AFTER INSERT ON `products` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'insert';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table v$product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_u` AFTER UPDATE ON `products` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table v$product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_d` AFTER DELETE ON `products` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'delete';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- 物料私有属性新增、更新、删除时也需要更新物料索引 dongbw 2018年5月28日 16:13:46
- -- ----------------------------
- -- Triggers structure for table product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_private_i`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_private_i` AFTER INSERT ON `product$private` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=new.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_private_u`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_private_u` AFTER UPDATE ON `product$private` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
- -- ----------------------------
- -- Triggers structure for table product$private
- -- ----------------------------
- DROP TRIGGER IF EXISTS `lucene_product_private_d`;
- delimiter ;;
- CREATE DEFINER = `root`@`%` TRIGGER `lucene_product_private_d` AFTER DELETE ON `product$private` FOR EACH ROW begin
- declare v_table_name varchar(64) default 'v$product$private';
- declare v_method_type varchar(6) default 'update';
- declare v_data_id int;
- declare v_data text default null;
- declare v_priority int default 1;
- set v_data_id=old.pr_id;
- call enqueue_lucene_message(v_table_name, v_method_type, v_data_id, v_data, v_priority);
- end
- ;;
- delimiter ;
|