Query q = Query.instance();
q.addInLongWhere("id", contractIds);
q.setPageSize(contractIds.size());
q.setSelectFieldsArray("*", "goods.*");
PageInfo<ContractModel> page = setServiceClientService.contractV2Query(q);
获取分页数据
@Override
public PageInfo<ContractModel> contractV2Query(Query query) {
ResponseModel responseModel = setServiceClient.queryContract(query);
if(!responseModel.getResult()) {
PageInfo<ContractModel> pageInfo = new PageInfo<>();
pageInfo.setList(Collections.emptyList());
return pageInfo;
}
JSONObject jsonObject = responseModel.getJSONObject(new JSONObject());
JSONArray jsonArray = jsonObject.getJSONArray("list");
List<ContractModel> contractModels = new ArrayList<>(jsonArray.size());
for(int i = 0; i < jsonArray.size(); i++) {
ContractModel contractModel = jsonArray.getObject(i, ContractModel.class);
contractModels.add(contractModel);
}
PageInfo<?> page = responseModel.getBeanValue(PageInfo.class);
PageInfo<ContractModel> pageInfo = new PageInfo<>();
BeanUtils.copyProperties(page, pageInfo, "list");
pageInfo.setList(contractModels);
return pageInfo;
}
正文完