org.apache.commons.beanutils.BeanUtils 和 org.springframework.beans.BeanUtils区别
程序员文章站
2022-05-02 09:49:13
...
org.apache.commons.beanutils.BeanUtils 和 org.springframework.beans.BeanUtils区别
Apache的beanuntils在遇到int/long的null进行复制的时候会变成0
spring的beanuntils就正常到时两个的des目标对象和src源对象左右位置不一样
在替换apache.BeanUtils的时候需要注意
目前copylist的工具类是用了apache的所以遇到int/long为null会变成0,有必要可以反编译改
@Override
public BaseResponse<List<FinancialSalesUser>> selectUserNoAssign() { List<FinancialSalesUser> financialSalesUser = new ArrayList<>(); try { // FinancialSalesUserCondition financialSalesUserCondition= new FinancialSalesUserCondition(); // Map<String, Object> paramMap = PropertyConverter.object2Map(financialSalesUserCondition); // FinancialSalesUserDO financialSales = new FinancialSalesUserDO(); List<FinancialSalesUserDO> financialSalesUserDOs = financialSalesUserDOMapper.selectUserNoAssign(); if (CollectionUtils.isNotEmpty(financialSalesUserDOs)) { BeanUtilsCopy.copyList(financialSalesUser, financialSalesUserDOs, FinancialSalesUser.class); } } catch (Exception e) { log.error("查询错误" + e); return new BaseResponse<>(false, null); } return new BaseResponse<List<FinancialSalesUser>>(financialSalesUser); }
上一篇: Java操作PDF之iText超入门
下一篇: Collection