create trigger wg_intercept_command_log_trigger
before insert on wg_intercept_command_log
for each row #这句话在mysql是固定的
begin
if not exists(
select 1 from wg_intercept_command_log where process_id=new.process_id
and unit_id=new.unit_id
and type='MOVE_EVENT'
and begin_time=new.begin_time
and end_time=new.end_time
)then
insert into wg_intercept_command_log
values
(
new.id,
new.type,
new.begin_time,
new.end_time,
new.unit_id,
new.target_unit_id,
new.process_id,
new.force_side_id,
new.sucess
);
end if;
end;
before insert on wg_intercept_command_log
for each row #这句话在mysql是固定的
begin
if not exists(
select 1 from wg_intercept_command_log where process_id=new.process_id
and unit_id=new.unit_id
and type='MOVE_EVENT'
and begin_time=new.begin_time
and end_time=new.end_time
)then
insert into wg_intercept_command_log
values
(
new.id,
new.type,
new.begin_time,
new.end_time,
new.unit_id,
new.target_unit_id,
new.process_id,
new.force_side_id,
new.sucess
);
end if;
end;