company_ids = ['2', '24', '1', '7', '373']
query = Company.query.filter(Company.id.in_(company_ids)).order_by(func.idx
    (company_ids, Company.id))
following_companies_list_data = query.paginate(page, per_page=10, error_out
    =False)
Keep the order of list in sql pagination