方法一:
使用BeanUtils.copyProperties
// 使用BeanUtils.copyProperties需要数据源和目标对象有继承关系,如果没继承关系会报错
{
"msg": "Target class [java.util.ArrayList] not assignable to Editable class [tech.develop100.biz.domain.vo.BizBuildingDepositRefundApplyExportVo]",
"code": 500
}
方法二:
使用JSON.toJSONString先将列表转化为字符串,再用JSON.parseArray转化成指定类的集合
// right
List<BizBuildingDepositRefundApplyListVo> list = bizBuildingDepositRefundService.selectDepositRefundApplyList(depositRefundVo);
List<BizBuildingDepositRefundApplyExportVo> exp = new ArrayList<BizBuildingDepositRefundApplyExportVo>();
String obj=JSON.toJSONString(list);
exp=JSON.parseArray(obj,BizBuildingDepositRefundApplyExportVo.class);