ListlistFireInspectInformation=stRiskFireInspectRepository.getFireInspectInformation(permitId); 返回是:
[["name1","name2","name3"],["name4","name5","name6"],["name7","name8","name9"]]
这种想获取里面具体的值name 则可以采取以下的方式:
@Override
public List<StRiskFireInspectDto> getFireInspectInformation(String permitId) {
List<StRiskFireInspectDto>list=new ArrayList<StRiskFireInspectDto>();
List<StRiskFireInspect>listFireInspectInformation=stRiskFireInspectRepository.getFireInspectInformation(permitId);
if (listFireInspectInformation.size()>0 && !listFireInspectInformation.isEmpty()) {
for (int i = 0; i < listFireInspectInformation.size(); i++) {
StRiskFireInspectDto wpRiskFireInspectDto = new StRiskFireInspectDto();
//把每个对象数据通过JSON.toJSONString 转化为 JSON字符串
String s = JSON.toJSONString(listFireInspectInformation.get(i));
JSONArray objects = JSONArray.parseArray(s);
String codeName = objects.getString(0);
String confirmor = objects.getString(1);
String confirmorSign = objects.getString(2);
wpRiskFireInspectDto.setConfirmor(confirmor);
wpRiskFireInspectDto.setConfirmorSign(confirmorSign);
wpRiskFireInspectDto.setCodeName(codeName);
list.add(wpRiskFireInspectDto);
}
return list;
}
return null;
}