<iftest="key != null and key !='' "> and res.product_name like #{key} </if>
<iftest="key != null and key !='' "> and res.product_name like #{key} </if>
<iftest=" projectId !=null and projectId!=''">
<iftest=" linkProjectId !=null and linkProjectId!=''">
and exists( select 1 from xm_product_project_link ppl
and exists( select 1 from xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id=res.id
where ppl.project_id=#{linkProjectId} and ppl.product_id=res.id
)
)
</if>
</if>
<iftest=" iterationId !=null and iterationId!=''">
and exists( select 1 from xm_iteration ppl
where ppl.id=#{iterationId} and ppl.product_id=res.id
)
<iftest=" linkIterationId !=null and linkIterationId!=''">
and exists( select 1 from xm_iteration ppl where ppl.product_id=res.id and ppl.id=#{linkIterationId} )
</if>
</if>
<iftest="compete !=null and compete!=''">
<iftest="compete !=null and compete!=''">
and ( exists ( select 1 from xm_group_user gu inner join 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 )
and ( exists ( select 1 from xm_group_user gu inner join 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 )
@ -29,6 +27,9 @@
)
)
</if>
</if>
<iftest="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<iftest="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<iftest="isTpl!=null and isTpl=='1'">
and (res.branch_id in( #{platformBranchId},#{myBranchId}) and res.is_tpl='1')
and exists( select 1 from 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 ipl where ipl.product_id =res.id and ipl.id=#{iterationId} )
</if>
<iftest="compete !=null and compete!=''">
and ( exists ( select 1 from xm_group_user gu inner join 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="key != null and key !='' "> and res.product_name like #{key} </if>
<iftest="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<iftest="isTpl!=null and isTpl=='1'">
and (res.branch_id in( #{platformBranchId},#{myBranchId}) and res.is_tpl='1')