-- 删除已有的触发器(如果存在)DROP TRIGGER IF EXISTS after_update_shenghuo;-- 创建触发器DELIMITER //CREATE TRIGGER after_update_shenghuoAFTER UPDATE ON `shenghuo-ycljg`FOR EACH ROWBEGIN -- 检查是否存在字段值发生变化 IF NEW.lianjieID <> OLD.lianjieID OR NEW.fenlei <> OLD.fenlei OR NEW.mingcheng <> OLD.mingcheng OR NEW.guige <> OLD.guige OR NEW.danwei <> OLD.danwei OR NEW.weishuidanjia <> OLD.weishuidanjia OR NEW.danjiaKG <> OLD.danjiaKG OR NEW.beizhu <> OLD.beizhu OR NEW.xiugairen <> OLD.xiugairen OR NEW.xiugaishijian <> OLD.xiugaishijian THEN -- 插入数据到 shenghuo-ycljglsjl 表 INSERT INTO `shenghuo-ycljglsjl` (uuid, lianjieID, fenlei, mingcheng, guige, danwei, weishuidanjia, danjiaKG, beizhu, xiugairen, xiugaishijian) VALUES (UUID(), NEW.lianjieID, NEW.fenlei, NEW.mingcheng, NEW.guige, NEW.danwei, NEW.weishuidanjia, NEW.danjiaKG, NEW.beizhu, NEW.xiugairen, NEW.xiugaishijian); END IF;END;//DELIMITER ;