<iftest="menuId != null and menuId !='' "> and im.menu_id=#{menuId} </if>
<iftest="menuId != null and menuId !='' "> and im.menu_id=#{menuId} </if>
)
)
</if>
</if>
<iftest=" projectId !=null and projectId!=''">
and exists( select 1 from XM.xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id
where t.project_id=#{projectId} and im.iteration_id =res.id
)
</if>
<iftest="compete !=null and compete!=''">
<iftest="compete !=null and compete!=''">
and ( res.admin_userid=#{compete}
and ( res.admin_userid=#{compete}
or exists (select 1 from XM.xm_iteration_menu im left join xm.xm_menu m on im.product_id=m.product_id where m.mm_userid=#{compete} and im.iteration_id=res.id)
or exists (select 1 from XM.xm_iteration_menu im left join xm.xm_menu m on im.product_id=m.product_id where m.mm_userid=#{compete} and im.iteration_id=res.id)
and exists ( select 1 from XM.xm_my_focus f where f.userid=#{userid} and f.project_id=res.id )
and exists ( select 1 from XM.xm_my_focus f where f.userid=#{userid} and f.project_id=res.id )
</if>
</if>
<iftest="productId != null and productId !='' "> and exists ( select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and m.product_id=#{productId} where m.product_id=#{productId} and t.project_id=res.id) </if>
<iftest="productId != null and productId !='' ">
and exists ( select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and m.product_id=#{productId}
where m.product_id=#{productId} and t.project_id=res.id
)
</if>
<iftest="(iterationId!=null and iterationId!='' )">
and exists( select 1 from XM.xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id
where t.project_id=res.id and im.iteration_id =#{iterationId}
)
</if>
<iftest="key != null and key !='' "> and res.name like #{key} </if>
<iftest="key != null and key !='' "> and res.name like #{key} </if>