小知识点BeanUtils.copyProperties

时间:2022-12-16 23:09:02


通过BeanUtils.copyProperties可以时间拷贝对象中的值,下面的new String[]{"cid","agreeFlag","flag","publishTime","projectNum"}表示的不拷贝的属性值

CopyRight copyRight = copyRightService.createCopyRight(request, user);
//获得要修改的course,然后重新设置参数
CopyRight copyRightInDataBase = copyRightService.findByCopyRightId(copyRight.getCid());
BeanUtils.copyProperties(copyRight, copyRightInDataBase,
      new String[]{"cid","agreeFlag","flag","publishTime","projectNum"})