这里写目录标题
- sql查询listmap集合通过反射转实体类
- 使用Json格式化工具类
sql查询listmap集合通过反射转实体类
List
使用Json格式化工具类
public static void main(String[] args) {
Map hashMap = new HashMap<>();
hashMap.put("field1", "value1");
hashMap.put("field2", "value2");
hashMap.put("field3", "value3");
hashMap.put("field4", "value4");
hashMap.put("field5", "value5");
//将HashMap转为JSON,在转为Pojo01对象:
String toJSON = JSONObject.toJSONString(hashMap);
Pojo01 pojo01 = JSONObject.toJavaObject(JSON.parseObject(toJSON), Pojo01.class);
System.out.println(" pojo01 = " + pojo01.toString());
}
```