query = Company.query.filter(Company.id.in_(company_ids)).order_by(*
    order_expressions)
following_companies_list_data = query.paginate(page, per_page=10, error_out
    =False)
Keep the order of list in sql pagination