from t_detector_user a left join t_enterprise_info b on a.beyond_enterprise_id=b.enterprise_id
left join t_user_manage_village v on a.f_village_id=v.f_village_id
<where> a.is_del = '0'
<iftest="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and a.beyond_enterprise_id =#{beyondEnterpriseId}</if>
<iftest="username != null and username != ''"> and a.username like concat('%', #{username}, '%')</if>
<iftest="nickName != null and nickName != ''"> and (a.nick_name like concat('%', #{nickName}, '%') or a.username like concat('%', #{nickName}, '%'))</if>