DROP TRIGGER IF EXISTS `trigger_fire_equipment_point_update`;
CREATE TRIGGER `trigger_fire_equipment_point_update` AFTER UPDATE ON `f_fire_equipment_point` FOR EACH ROW
BEGIN
DECLARE num1 INT (4) default 0;
select count(1) into num1 from f_fire_equipment_point where fire_equipment_id = new.fire_equipment_id and type='SWITCH' and 0x4000>=CAST(code AS SIGNED) and value = 'true';
if num1 > 0 then
update f_fire_equipment set equip_status = 1 where id = new.fire_equipment_id;
else
update f_fire_equipment set equip_status = 0 where id = new.fire_equipment_id;