用 BeanUtils.copyProperties(), 两个参数是上面的条件资源和目标对象.
private static RegistTimeImportLogtransToImportLog(RegistTimeImportLogDto dto) {
RegistTimeImportLog importLog = new RegistTimeImportLog();
try {
BeanUtils.copyProperties(dto,importLog);
} catch (IllegalAccessExceptione) {
e.printStackTrace();
} catch (InvocationTargetExceptione) {
e.printStackTrace();
}
return importLog;
}
原文:https://www.cnblogs.com/youngniulove/p/14753824.html