bean之间的相互拷贝

  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>();

猜你喜欢

转载自yuhuiblog6338999322098842.iteye.com/blog/2315758