or ((select id from tbl_userdev where a.dev_id=dev_id and a.dev_type=dev_type and user_id=4) is not null)
or (a.dev_type=4 and (select id from tbl_userdev where dev_type=9 and user_id=4 and dev_id in (select a_id from tbl_point where id=a.dev_id)) is not null)
or (a.dev_type=7 and a.serverid=0 and (select id from tbl_patroluser where a.dev_id=ep_id and userid=4 or userid in (select id from tbl_user where creater_id=4)) is not null)
or (a.dev_type=7 and a.serverid<>0)
or ((a.dev_type=1 or a.dev_type=128) and (select id from tbl_userdev where user_id=4 and dev_type=64 and dev_no=a.puid and dev_id=a.channel) is not null))
and a.alarm_time>=FROM_UNIXTIME(1330531200) and a.alarm_time<FROM_UNIXTIME(1363190399) and a.serverid=0