String url="https://erp.sunjoin.cn/business/TbCompany/list?pageNum=1&pageSize=10&regionId=";
        //创建RestTemplate实例
        RestTemplate restTemplate = new RestTemplate();
        //设置请求头比如token
        // 和设置请求类型 application/json:用于指定请求体使用JSON格式进行编码。
        //              application/x-www-form-urlencoded:用于指定请求体使用URL编码格式(键值对)。
        //              multipart/form-data:用于指定请求体包含多部分数据,通常用于文件上传。
        //              text/plain:用于指定请求体是纯文本格式。
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.set("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImRjZWU4NjVjLTA3ZDAtNGJkMi05OTgwLTUyZjA3YzkwYzJiNyJ9.8cvobkPBoCw6MUxPHNxCYAVHUoOi1c5L5mngpTmKcRzBWZ2rqymZUX5_xm40Y8RgP5XnrTwFGIa8-zLmoIgJIA");
        httpHeaders.set("Content-Type", "application/json");
        //构建请求体
        HttpEntity<Object> entity = new HttpEntity<>(httpHeaders);
        //发起请求
        String body = restTemplate.exchange(url, HttpMethod.GET, entity, String.class).getBody();
        Result result = JSONObject.parseObject(body, Result.class);
        
        for (Company c:
                result.getRows()
        ) {
            System.out.println(c);
        }

创建对应的Result对象和Company对象接收数据,最终打印效果 image.png