Try this
<?php
namespace Vendor\Module\Controller\Orders;
class SetOrders extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
protected $itemFactory;
public function __construct(
\Magento\Sales\Model\Order\ItemFactory $itemFactory,
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->itemFactory = $itemFactory;
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
try {
$current_seller_id = 5;
$order = $this->itemFactory->create()->getCollection()->addFieldToFilter('current_seller_id', $current_seller_id);
foreach ($order as $items) {
echo $itemId = $items->getItemId();
}
echo "success";
} catch (\Exception $e) {
error_log($e->getMessage());
}
}
}
Hope this helps :)