使用fastJson报错
不知道为什么FastJson.getJson().toJson会请求数据库
代码出错内容
首先先打出查询数据库,然后进入报错死循环。
2019-07-10 at 13:18:18 CST ERROR com.yiww.fw.log.Log4j2Log 49 error - write javaBean error, fastjson version 1.2.41, class com.yiww.backend.business.model.Adpage, fieldName : 0, write javaBean error, fastjson version 1.2.41, class com.yiww.backend.business.model.Adpage, fieldName : 0, write javaBean error, fastjson version 1.2.41, class com.yiww.backend.business.model.Adpage, fieldName : 0, write javaBean error, fastjson version 1.2.41, class
代码:
sql脚本
项目:JFinal
Page page = getPage(pageNumber, pageSize, cond, adpageDao, "mariketing.statisticsList");
List list = page.getList();
ArrayList arrayList = new ArrayList<>();
for (Adpage adpage : list) {
String json = JsonKit.toJson(adpage);
Map map = (Map) JSON.parse(json);
String countStr = (String) map.get("count");
if (StrKit.isBlank(countStr)) {
countStr = "{}";
}
OpenCount openCount = JSON.parseObject(countStr, OpenCount.class);
map.put("count", openCount);
arrayList.add(map);
}
Page page2 = new Page(arrayList, page.getPageNumber(), page.getPageSize(), page.getTotalPage(), page.getTotalRow());
return page2;
}