private function updateAttributeDefaultValue($entityTypeId, $attributeId, $value, $excludedIds = [])
{
$setup = $this->eavSetup->getSetup();
$entityTable = $setup->getTable($this->eavSetup->getEntityType($entityTypeId, 'entity_table'));
$attributeTable = $this->eavSetup->getAttributeTable($entityTypeId, $attributeId);
if (!is_int($attributeId)) {
$attributeId = $this->eavSetup->getAttributeId($entityTypeId, $attributeId);
}
// Retrieve the primary key name. May differs if the staging module is activated or not.
$linkField = $this->metadataPool->getMetadata(CategoryInterface::class)->getLinkField();
$entitySelect = $this->getConnection()->select();
$entitySelect->from($entityTable, [new \Zend_Db_Expr("{$attributeId} as attribute_id"), $linkField, new \Zend_Db_Expr("{$value} as value")]);
if (!empty($excludedIds)) {
$entitySelect->where("entity_id NOT IN(?)", $excludedIds);
}
$insertQuery = $this->getConnection()->insertFromSelect($entitySelect, $attributeTable, ['attribute_id', $linkField, 'value'], AdapterInterface::INSERT_ON_DUPLICATE);
$this->getConnection()->query($insertQuery);
}