import org.springframework.beans.BeanUtils;
/**
* DO转VO
*/
public static <T> List<T> copyList(List<?> doList, Class<T> voClass) {
List<T> voList = new ArrayList<>();
try {
T voObj = null;
for (Object doObj : doList) {
voObj = voClass.newInstance();
BeanUtils.copyProperties(doObj, voObj);
voList.add(voObj);
}
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return voList;
}
将DO转VO工具类
猜你喜欢
转载自blog.csdn.net/chinasi2012/article/details/85595471
今日推荐
周排行