String类型装换为json对象再保存
private String repJson;
public void savePolling() throws JsonGenerationException, JsonMappingException, IOException {
//repj = new ResponseEquipmentPollingJson();if(StringUtils.isNotEmpty(repJson)){
ObjectMapper mapper = new ObjectMapper();//eg.{"name":"1","age":"2"} 调用转换工具
ResponseEquipmentPollingJson rep = mapper.readValue(repJson, ResponseEquipmentPollingJson.class);//string类型 转换 为json
Polling polling = rep.getPolling();
dm.save(polling);
}
}