select c.*,u.realname,u.username,p.ifpayment as ifpayment from t_bus_leave c left join t_s_base_user u on c.userid = u.id left join t_bus_user_personnel p on u.id = p.userid where 1=1 <#if (leaveDto.username )?? && leaveDto.username ?length gt 0> /* 转正人编号 */ and u.username like CONCAT('%', :leaveDto.username ,'%') <#if (leaveDto.realname )?? && leaveDto.realname ?length gt 0> /* 转正人名称 */ and u.realname like CONCAT('%', :leaveDto.realname ,'%') <#if ( leaveDto.bpmStatus )?? && leaveDto.bpmStatus ?length gt 0> /* 申请状态*/ and c.bpm_status = :leaveDto.bpmStatus <#if ( leaveDto.leaveType )?? && leaveDto.leaveType ?length gt 0> /* 申请状态*/ and c.leave_type = :leaveDto.leaveType <#if ( leaveDto.orgIdList )?? && leaveDto.orgIdList ?size gt 0> /* 所属单位*/ and c.belong_unitid in( <#list leaveDto.orgIdList as item> '${item}' <#if item_has_next>, ) <#if ( leaveDto.applyDate_begin )?? && leaveDto.applyDate_begin ?length gt 0> /* 申请日期 */ and c.apply_date >= :leaveDto.applyDate_begin <#if ( leaveDto.applyDate_end )?? && leaveDto.applyDate_end ?length gt 0> /* 申请日期 */ and c.apply_date <= :leaveDto.applyDate_end <#if ( leaveDto.leaveDate_begin )?? && leaveDto.leaveDate_begin ?length gt 0> /* 离职日期 */ and to_days(c.leave_date) >= to_days(:leaveDto.leaveDate_begin) <#if ( leaveDto.leaveDate_end )?? && leaveDto.leaveDate_end ?length gt 0> /* 离职日期 */ and to_days(c.leave_date) <= to_days(:leaveDto.leaveDate_end) <#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>, ) and c.belong_unitid in( <#list orgidList as item> '${item}' <#if item_has_next>, )) or c.applicant_id in( <#list useridList1 as item> '${item}' <#if item_has_next>, )) <#else> and c.applicant_id in( <#list useridList1 as item> '${item}' <#if item_has_next>, ) and c.delete_flag = 0 ORDER BY c.create_date DESC,c.leave_date DESC