1.创建存储过程
CREATE PROCEDURE `update_cloud_componentrepairrecorTime`()
BEGIN
update cloud_componentrepairrecord
set
StartTime = now(),
Endtime = date_add( now() , INTERVAL datediff(Starttime ,Endtime) day )
where endtime<=now();
END
2.定时执行
CREATE EVENT event_update_cloud_componentrepairrecorTime
ON SCHEDULE EVERY 1 DAY STARTS '2018-06-01 00:00:00'
ON COMPLETION PRESERVE
ENABLE
DO call update_cloud_componentrepairrecorTime();