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
left join t_gasuser_safety_device_info deviceInfo on a.user_id = deviceInfo.f_relation_gasUser_id
<where> a.is_del = '0' and a.error_msg is null
<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>