Map
转Java Bean
:
public ResponseResult addDataTable(Map<String, Object> params) {
String jsonString = JSON.toJSONString(params);
DmDataTable dataTable = JSON.parseObject(jsonString, DmDataTable.class);
DmApprovalInfo approvalInfo = JSON.parseObject(jsonString, DmApprovalInfo.class);
return new ResponseResult(insertSelective(dataTable.setTableId(UUIDUtil.uuid())));
}
Java Bean
转Map
:
OrganStaffDto staffDto = queryStaffDtoByOrganId(user2.get("organId"));
String jsonStr = JSON.toJSONString(staffDto);
Map<String,String> staffMap = (Map)JSON.parseObject(jsonStr);
References