CREATE TRIGGER `after_plan_order_insert` AFTER INSERT ON `plan_order`
FOR EACH ROW
BEGIN
INSERT INTO `plan_order_log` (
id,
operate_type,
plan_id,
number,
orderTimeStart,
orderTimeEnd,
orderTime,
unit,
shipBoarding,
visitRoute,
paymentMethod,
phonenumber,
contact,
orderNature,
create_by,
create_time,
update_by,
update_time,
remark,
status,
guideNum,
shipNum
) VALUES (
NEW.id,
‘insert’,
NEW.plan_id,
NEW.number,
NEW.orderTimeStart,
NEW.orderTimeEnd,
NEW.orderTime,
NEW.unit,
NEW.shipBoarding,
NEW.visitRoute,
NEW.paymentMethod,
NEW.phonenumber,
NEW.contact,
NEW.orderNature,
NEW.create_by,
NEW.create_time,
NEW.update_by,
NEW.update_time,
NEW.remark,
NEW.status,
NEW.guideNum,
NEW.shipNum
);
END;
CREATE TRIGGER `after_plan_order_update` AFTER UPDATE ON `plan_order`
FOR EACH ROW
BEGIN
INSERT INTO `plan_order_log` (
id,
operate_type,
plan_id,
number,
orderTimeStart,
orderTimeEnd,
orderTime,
unit,
shipBoarding,
visitRoute,
paymentMethod,
phonenumber,
contact,
orderNature,
create_by,
create_time,
update_by,
update_time,
remark,
status,
guideNum,
shipNum
) VALUES (
NEW.id,
‘update’,
NEW.plan_id,
NEW.number,
NEW.orderTimeStart,
NEW.orderTimeEnd,
NEW.orderTime,
NEW.unit,
NEW.shipBoarding,
NEW.visitRoute,
NEW.paymentMethod,
NEW.phonenumber,
NEW.contact,
NEW.orderNature,
NEW.create_by,
NEW.create_time,
NEW.update_by,
NEW.update_time,
NEW.remark,
NEW.status,
NEW.guideNum,
NEW.shipNum
);
END;
CREATE TRIGGER `after_plan_order_delete` AFTER DELETE ON `plan_order`
FOR EACH ROW
BEGIN
INSERT INTO `plan_order_log` (
id,
operate_type,
plan_id,
number,
orderTimeStart,
orderTimeEnd,
orderTime,
unit,
shipBoarding,
visitRoute,
paymentMethod,
phonenumber,
contact,
orderNature,
create_by,
create_time,
update_by,
update_time,
remark,
status,
guideNum,
shipNumNavicat Premium 8.1.12激活
) VALUES (
OLD.id,
‘delete’,
OLD.plan_id,
OLD.number,
OLD.orderTimeStart,
OLD.orderTimeEnd,
OLD.orderTime,
OLD.unit,
OLD.shipBoarding,
OLD.visitRoute,
OLD.paymentMethod,
OLD.phonenumber,
OLD.contact,
OLD.orderNature,
OLD.create_by,
OLD.create_time,
OLD.update_by,
OLD.update_time,
OLD.remark,
OLD.status,
OLD.guideNum,
OLD.shipNum
);
END;
今天的文章
Navicat Premium 8.1.12激活(使用mysql触发器实现保存用户操作历史记录)分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/114867.html