and exists( select 1 from xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id where t.project_phase_id=res.id and im.iteration_id=#{iterationId})
</if>
<iftest='productId!=null and productId!="" '>
and exists( select 1 from xm_task t where t.product_id=#{productId})
</if>
<iftest="key != null and key !='' "></if>
</where>
<iftest='iterationId!=null and iterationId!="" '>
and exists( select 1 from xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id where t.project_phase_id=res.id and im.iteration_id=#{iterationId})