select c.*,u.realname,u.username from t_bus_demote_transfer c left join t_s_base_user u on c.userid = u.id where 1=1
		<#if (samelevelTransferDao.username )?? && samelevelTransferDao.username ?length gt 0>
		    /* 转正人编号 */
			and u.username like CONCAT('%', :samelevelTransferDao.username ,'%') 
		</#if>
		<#if (samelevelTransferDao.realname )?? && samelevelTransferDao.realname ?length gt 0>
		    /* 转正人名称 */
			and u.realname like CONCAT('%', :samelevelTransferDao.realname ,'%') 
		</#if>
		<#if ( samelevelTransferDao.bpmStatus )?? && samelevelTransferDao.bpmStatus ?length gt 0>
		    /* 申请状态*/
			and c.bpm_status = :samelevelTransferDao.bpmStatus
		</#if>
		<#if ( samelevelTransferDao.orgIdList )?? && samelevelTransferDao.orgIdList ?size gt 0>
		    /* 所属单位*/
			and c.belong_unitid in(
			<#list samelevelTransferDao.orgIdList as item>        
			   '${item}'
			 <#if item_has_next>,</#if>
			 </#list>
			)
		</#if>
	    <#if ( samelevelTransferDao.applyDate_begin )?? && samelevelTransferDao.applyDate_begin ?length gt 0>
		    /* 申请日期 */
			and c.apply_date >= :samelevelTransferDao.applyDate_begin
		</#if>
		<#if ( samelevelTransferDao.applyDate_end )?? && samelevelTransferDao.applyDate_end ?length gt 0>
		    /* 申请日期 */
			and c.apply_date <= :samelevelTransferDao.applyDate_end
		</#if>	
		<#if ( samelevelTransferDao.outTime_begin )?? && samelevelTransferDao.outTime_begin ?length gt 0>
		    /* 调出日期 */
			and to_days(c.out_time) >= to_days(:samelevelTransferDao.outTime_begin)
		</#if>	
		<#if ( samelevelTransferDao.outTime_end )?? && samelevelTransferDao.outTime_end ?length gt 0>
		    /* 调出日期  */
			and to_days(c.out_time) <= to_days(:samelevelTransferDao.outTime_end)
		</#if>	
		<#if ( useridList )?? && useridList ?size gt 0 && ( orgidList )?? && orgidList ? size gt 0 >
			and ((c.applicant_id in(
			<#list useridList as item>   
			   '${item}'
			 <#if item_has_next>,</#if>
			 </#list>
			)
			and c.in_unitid in(
			<#list orgidList as item>   
			   '${item}'
			 <#if item_has_next>,</#if>
			 </#list>
			)) 
			or c.applicant_id in(
			<#list useridList1 as item>   
			   '${item}'
			 <#if item_has_next>,</#if>
			 </#list>
			)) 
			<#else>
			and c.applicant_id in(
			<#list useridList1 as item>   
			   '${item}'
			 <#if item_has_next>,</#if>
			 </#list>
			)
		</#if>
		and c.delete_flag = 0
		
		ORDER BY
			c.create_date DESC,c.in_time desc