修改
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.pictc.utils;
|
||||
|
||||
import com.xjrsoft.module.datalog.vo.CompareResultVo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -31,6 +32,18 @@ public class ObjectDiffUtils {
|
||||
return diffs;
|
||||
}
|
||||
|
||||
public static <T> CompareResultVo<T> result(List<T> list) {
|
||||
CompareResultVo<T> result = new CompareResultVo<>();
|
||||
T newBean = list.get(0);
|
||||
result.setNewBean(newBean);
|
||||
if (list.size() > 1) {
|
||||
T oldBean = list.get(1);
|
||||
result.setOldBean(oldBean);
|
||||
result.setDiffResultList(ObjectDiffUtils.compare(newBean, oldBean));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归比较对象字段
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user