public class BeanObject{
....
private Date createTime;
....
}
public class BeanObjectVO{
....
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date createTime;
....
}
....
com.github.pagehelper.PageInfo<BeanObject> pageInfo=getData(xxx);//获取数据
com.github.pagehelper.PageInfo<BeanObjectVO> pageData=new PageInfo<>();
org.springframework.beans.BeanUtils.copyProperties(pageInfo,pageData);
return pageData;
}
解决问题:
com.github.pagehelper.PageInfo<BeanObject> pageInfo=getData(xxx);//获取数据
List<BeanObject> list=pageInfo.getList();
List<BeanObjectVO> vos=new ArrayList<>();
if(list!=null){
BeanObjectVO vo;
for(BeanObject o:list){
vo=new BeanObjectVO();
org.springframework.beans.BeanUtils.copyProperties(o,vo);
vos.add(vo);
}
}
org.springframework.beans.BeanUtils.copyProperties(pageInfo,pageData);
pageData.setList(vos);
return pageData;
https://blog.xqlee.com/article/487.html