2
版本:1.2.41 问题描述:在springboot+mybatis中使用PageHelper插件,最后返回json数据的时候,没有正确解析出来PageInfo对象内的list对象 我的写法是这样的:
List<HashMap> detailList = (mybatis查询结果);
PageInfo<HashMap> pageInfo = new PageInfo(detailList);
Map<String,Object> resultMap = new HashMap();
resultMap.put("page",pageInfo);
resultMap.put("detailList",detailList);
return JSONObject.toJSONString(resultMap);
最后的结果:{"page":{"endRow":2,"firstPage":1,"hasNextPage":false,"hasPreviousPage":false,"isFirstPage":true,"isLastPage":true,"lastPage":1,"list":[{"$ref":"$.detailList[0]"},{"$ref":"$.detailList[1]"}],"navigatePages":8,"navigatepageNums":[1],"nextPage":0,"pageNum":1,"pageSize":10,"pages":1,"prePage":0,"size":2,"startRow":1,"total":2}} detailList解析正确就不贴了