and ( exists ( select 1 from xm_group_user gu inner join xm_product_project_link t on (gu.project_id=t.project_id or gu.product_id=t.product_id ) and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id )
or res.create_userid=#{compete} or res.pm_userid=#{compete} or res.pm_userid=#{compete} or res.adm_userid=#{compete} or res.ass_userid=#{compete}
or res.pm_userid=#{compete} or res.adm_userid=#{compete} or res.ass_userid=#{compete}
)
</if>
<iftest="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>