Entity entity = entityMapper.selectByPrimaryKey(productId);
// 实体中某个字符串,{a=1,b=2}格式转成map
String modifyValue = entity.getModifyValue();
// 回显数据
Map<String, Object> modifyValueMap = new HashMap<>();
if (StringUtils.isNotBlank(modifyValue)) {
Gson gson = new Gson();
modifyValueMap = gson.fromJson(modifyValue, modifyValueMap.getClass());
}
// 实体转map
Map<String, Object> map = JSON.parseObject(JSON.toJSONString(entity), Map.class);
实体转map,字符串,{a=1,b=2}格式转成map
最新推荐文章于 2023-12-12 18:53:36 发布