接口是这样的
@DeleteMapping
@ApiOperation("删除数据")
public R<Boolean> delete(@RequestParam("idList") List<Long> idList) {
return success(this.jobJdbcDatasourceService.removeByIds(idList));
}
我的调用方式是这样的
@Override
public void deleteDataSource(List<String> ids) {
if (CollectionUtils.isEmpty(ids)){
return;
}
List<Long> datasourceIds = ids.stream().map(Long::parseLong).collect(Collectors.toList());
MultiValueMap<String,Object> params = new LinkedMultiValueMap<>();
params.add("idList",datasourceIds);
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(params,new HttpHeaders());
ResponseEntity<DataXResponse> exchange = restTemplate.exchange(adminServer + dataSourcePath,HttpMethod.DELETE,entity,DataXResponse.class);
boolean isSuccess = this.handleResponse(exchange,Boolean.class);
if (!isSuccess){
throw new FastdataException(FastdataPlatErrorCode.REST_CALL_FAILED.getCode(),"删除失败");
}
}
然后服务端报错了
Caused by: java.lang.NumberFormatException: For input string: "[12]"
意思就是需要一个 list,但是接受到一个 string
有大哥遇到过这样的情况吗