bean之间的相互拷贝

来源:互联网 发布:手机淘宝能删除好评吗? 编辑:程序博客网 时间:2024/05/17 23:56

  bean之间的相互拷贝

  直接将bean赋值给bo

  import org.springframework.beans.BeanUtils;

  public CusFirmBeanVo findByCustomerKey(long customerKey) {

CusFirmBean entity = cusFirmDao.findByCustomerKey(customerKey);

if (entity == null)

return null;

CusFirmBeanVo target = new CusFirmBeanVo();

BeanUtils.copyProperties(entity, target);

return target;

}

 

TbCusUserBean bo = new TbCusUserBean();

BeanUtils.copyProperties(tbCusUserBeanVo, bo, "rolesName","rolesKey");//忽略属性拷贝

Map<String, Object> paramUp = new HashMap<String, Object>();

 

0 0
原创粉丝点击