select DISTINCT pdu.userNum as username,c.daikou_debit as daikouDebit,c.*,u.realname,u.id as userids,d.departname as belongUnitName,du.duties_name as duname,pdu.idcard as pduname,fin.belong_bank,fin.card_number as finid
FROM t_s_base_user u
LEFT JOIN t_bus_user_wage c on u.ID = c.userid and u.delete_flag=0 and c.monthly = :userWageDto.monthly
LEFT JOIN t_bus_user_personnel per on u.id= per.userid
LEFT JOIN t_s_user_org uo on uo.user_id = u.ID and uo.ifpluralism = 0 and uo.status = 0 
left join t_s_depart d on d.id = c.pjt_id
LEFT JOIN t_s_depart dt on dt.ID = uo.org_id
left join t_bus_duties du on du.id = per.belong_dutiesid
left join t_s_user pdu on pdu.id = u.id
left join t_bus_user_financial fin on fin.userid = u.id and isdefault = '1'and fin.delete_flag='0'
where 1=1 AND u.delete_flag=0 and (u.status=1 or u.status=-1) and per.position_status != 0
<#if (userWageDto.realname )?? && userWageDto.realname ?length gt 0>
    /* 转正人名称 */
	and u.realname like CONCAT('%', :userWageDto.realname ,'%') 
</#if>
<#if ( userWageDto.bpmStatus )?? && userWageDto.bpmStatus ?length gt 0>
    /* 申请状态*/
	and c.bpm_status = :userWageDto.bpmStatus
</#if>
<#if ( userWageDto.orgIdList )?? && userWageDto.orgIdList ?size gt 0>
    /* 所属单位*/
	and dt.id in(
	<#list userWageDto.orgIdList as item>        
	   '${item}'
	 <#if item_has_next>,</#if>
	 </#list>
	)
</#if>
<#if ( uidList )?? && uidList ?size gt 0>
	/* 可见的用户id */
	and u.id in(
	<#list uidList as item>   
		'${item}'
	<#if item_has_next>,</#if>
	</#list>
	)
</#if>
<#if ( moth )?? && moth ?length gt 0>
    /* 申请状态*/
	and (per.leave_date > :moth or per.leave_date is null)
</#if>
order by d.departname