<#-- 月度排班人员选择页面 --> select bu.id, bu.id as userid, bu.username, bu.realname, up.in_postid, up.position_status, up.contract_stime from t_s_base_user bu LEFT JOIN t_bus_user_personnel up ON bu.ID=up.userid <#-- from t_s_base_user bu --> <#-- LEFT JOIN t_bus_user_personnel up ON up.userid=bu.ID --> LEFT JOIN t_s_user_org uo ON uo.user_id = bu.id WHERE 1=1 <#if ( userAndUserPersonnelDto.childDepartIdList )?? && userAndUserPersonnelDto.childDepartIdList ?size gt 0> AND uo.org_id IN( <#list userAndUserPersonnelDto.childDepartIdList as item> '${item}' <#if item_has_next>, ) <#else > and uo.org_id=null <#if ( userAndUserPersonnelDto.userIdList )?? && userAndUserPersonnelDto.userIdList ?size gt 0> and bu.id not in( <#list userAndUserPersonnelDto.userIdList as item> '${item}' <#if item_has_next>, ) <#if (userAndUserPersonnelDto.realname )?? && userAndUserPersonnelDto.realname ?length gt 0> and bu.realname like CONCAT('%', :userAndUserPersonnelDto.realname ,'%') AND bu.delete_flag = '0' AND uo. STATUS = '0' AND uo.ifpluralism = '0' order by convert(bu.realname using gbk) collate gbk_Chinese_ci asc