<iftest=" onlineTimeStart !=null "> and res.online_time > #{onlineTimeStart} </if>
<iftest=" onlineTimeEnd !=null "> and res.online_time < #{onlineTimeEnd} </if>
<includerefid="where"/>
<iftest="( productId != null and productId !='') or ( menuId != null and menuId !='')">
and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id
<iftest=" ( menuId != null and menuId !='')">
and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id and im.menu_id=#{menuId}
<iftest="productId != null and productId !='' "> and im.product_id=#{productId} </if>
<iftest="menuId != null and menuId !='' "> and im.menu_id=#{menuId} </if>
)
</if>
<iftest="( productId != null and productId !='') and ( menuId == null or menuId =='') and ( projectId ==null or projectId=='' ) ">
and exists ( select 1 from xm_iteration_product_link ipl
where ipl.iteration_id=res.id and ipl.product_id=#{productId}
)
</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
and exists( select 1 from XM.xm_iteration_product_link ipl inner join XM.xm_product_project_link ppl
on ipl.product_id=ppl.product_id
where ppl.project_id=#{projectId} and ipl.iteration_id =res.id
<iftest=" productId != null and productId !='' "> and ipl.product_id=#{productId}</if>
)
</if>
<iftest="compete !=null and compete!=''">
@ -58,14 +65,29 @@
#{item}
</foreach>
</if>
<iftest=" createTimeStart !=null "> and res.ctime > #{createTimeStart} </if>
<iftest=" createTimeEnd !=null "> and res.ctime < #{createTimeEnd} </if>
<iftest=" onlineTimeStart !=null "> and res.online_time > #{onlineTimeStart} </if>
<iftest=" onlineTimeEnd !=null "> and res.online_time < #{onlineTimeEnd} </if>
<includerefid="where"/>
<iftest=" ( menuId != null and menuId !='')">
and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id and im.menu_id=#{menuId}
<iftest="productId != null and productId !='' "> and im.product_id=#{productId} </if>
)
</if>
<iftest="( productId != null and productId !='') or ( menuId != null and menuId !='')">
and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id
<iftest="productId != null and productId !='' "> and im.product_id=#{productId} </if>
<iftest="menuId != null and menuId !='' "> and im.menu_id=#{menuId} </if>
)
</if>
<iftest="( productId != null and productId !='') and ( menuId == null or menuId =='') and ( projectId ==null or projectId=='' ) ">
and exists ( select 1 from xm_iteration_product_link ipl
where ipl.iteration_id=res.id and ipl.product_id=#{productId}
)
</if>
<iftest=" projectId !=null and projectId!=''">
and exists( select 1 from XM.xm_iteration_product_link ipl inner join XM.xm_product_project_link ppl
on ipl.product_id=ppl.product_id
where ppl.project_id=#{projectId} and ipl.iteration_id =res.id
<iftest=" productId != null and productId !='' "> and ipl.product_id=#{productId}</if>
)
</if>
<iftest="compete !=null and 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)
<iftest="projectId != null and projectId !='' "> and exists (select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and t.project_id=#{projectId} where t.project_id=#{projectId} and m.product_id=res.id) </if>
<iftest="compete !=null and compete!=''">
<iftest=" projectId !=null and projectId!=''">
and exists( select 1 from XM.xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id=res.id
)
</if>
<iftest="iterationId!=null and iterationId!=''">
and exists( select 1 from xm_iteration_product_link ipl where ipl.product_id =res.id and ipl.iteration_id=#{iterationId} )
</if>
<iftest="compete !=null and compete!=''">
and ( exists ( select 1 from xm_project_group_user gu inner join XM.xm_task t on gu.project_id=t.project_id and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id )
or res.pm_userid=#{compete}
or exists ( select 1 from xm_menu m where m.mm_userid=#{compete} and m.product_id=res.id)
)
</if>
<iftest="iterationId!=null and iterationId!=''">
and exists( select 1 from xm_iteration_menu im where im.product_id =res.id and im.iteration_id=#{iterationId} )
</if>
<iftest="key != null and key !='' "> and res.product_name like #{key} </if>
</where>
</select>
@ -46,8 +50,12 @@
</if>
<includerefid="where"/>
<iftest="key != null and key !='' "> and res.product_name like #{key} </if>
<iftest="projectId != null and projectId !='' "> and exists (select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and t.project_id=#{projectId} where t.project_id=#{projectId} and m.product_id=res.id) </if>
<iftest="compete !=null and compete!=''">
<iftest=" projectId !=null and projectId!=''">
and exists( select 1 from XM.xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id=res.id
)
</if>
<iftest="compete !=null and compete!=''">
and ( exists ( select 1 from xm_project_group_user gu inner join XM.xm_task t on gu.project_id=t.project_id and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id )
or res.pm_userid=#{compete}
or exists ( select 1 from xm_menu m where m.mm_userid=#{compete} and m.product_id=res.id)