Commit e3fd5a3f authored by yanzg's avatar yanzg

表结构修改

parent b973369b
......@@ -32,16 +32,16 @@ public class DataDaoVo<T> {
/**
* 将历史数据映射为HashMap
*
* @param hisitories 历史数据
* @param keyFunc  获取主键函数
* @return
* @param hisList 历史数据
* @param keyFunc 获取主键函数
* @return 映射值
*/
private Map<String, T> getMapHistory(List<T> hisitories, DataDaoKey<T> keyFunc) {
private Map<String, T> getMapHistory(List<T> hisList, DataDaoKey<T> keyFunc) {
// 定义缓存集合
Map<String, T> mapHistory = new HashMap<>(10);
// 历史数据处理
if (hisitories != null) {
for (T his : hisitories) {
if (hisList != null) {
for (T his : hisList) {
if (his == null) {
continue;
}
......@@ -55,18 +55,17 @@ public class DataDaoVo<T> {
/**
* 获取结果
*
* @param hisitories 历史数据
* @param hisList 历史数据
* @param mapHistory 历史数据映射
* @param nows 当前数据
* @param nowList 当前数据
* @param keyFunc 获取主键函数
* @return 返回值
*/
private void addResult(List<T> hisitories, Map<String, T> mapHistory, List<T> nows, DataDaoKey<T> keyFunc) {
private void addResult(List<T> hisList, Map<String, T> mapHistory, List<T> nowList, DataDaoKey<T> keyFunc) {
// 需要删除的集合
List<T> historyRemove = new ArrayList<>(hisitories);
List<T> historyRemove = new ArrayList<>(hisList);
// 返回集
if (nows != null) {
for (T now : nows) {
if (nowList != null) {
for (T now : nowList) {
if (now == null) {
continue;
}
......@@ -92,45 +91,45 @@ public class DataDaoVo<T> {
/**
* 初始话对象
*
* @param hisitories
* @param nows
* @param keyFunc
* @param hisList 历史列表
* @param nowList 当前列表
* @param keyFunc 函数
*/
public void add(List<T> hisitories, List<T> nows, DataDaoKey<T> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisitories, keyFunc);
addResult(hisitories, mapHistory, nows, keyFunc);
public void add(List<T> hisList, List<T> nowList, DataDaoKey<T> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisList, keyFunc);
addResult(hisList, mapHistory, nowList, keyFunc);
}
/**
* 初始话对象
*
* @param hisitories
* @param nows
* @param keyFunc
* @param hisList 历史列表
* @param nowList 当前列表
* @param keyFunc 处理函数
*/
public <M> void add(List<T> hisitories, List<M> nows, DataDaoKeyConvert<T, M> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisitories, keyFunc);
List<T> toNows = new ArrayList<>(10);
if (nows != null) {
for (M m : nows) {
public <M> void add(List<T> hisList, List<M> nowList, DataDaoKeyConvert<T, M> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisList, keyFunc);
List<T> nowListTo = new ArrayList<>(10);
if (nowList != null) {
for (M m : nowList) {
T t = keyFunc.convert(mapHistory, m);
toNows.add(t);
nowListTo.add(t);
}
}
addResult(hisitories, mapHistory, toNows, keyFunc);
addResult(hisList, mapHistory, nowListTo, keyFunc);
}
/**
* 初始话对象
*
* @param hisitories
* @param nows
* @param keyFunc
* @param hisList 历史列表
* @param nowList 当前列表
* @param keyFunc 处理函数
*/
public static <T> DataDaoVo<T> init(List<T> hisitories, List<T> nows, DataDaoKey<T> keyFunc) {
public static <T> DataDaoVo<T> init(List<T> hisList, List<T> nowList, DataDaoKey<T> keyFunc) {
DataDaoVo<T> res = new DataDaoVo<T>();
res.add(hisitories, nows, keyFunc);
res.add(hisList, nowList, keyFunc);
return res;
}
......@@ -138,13 +137,13 @@ public class DataDaoVo<T> {
/**
* 初始话对象
*
* @param hisitories
* @param nows
* @param keyFunc
* @param hisList 历史列表
* @param nowList 当前列表
* @param keyFunc 处理函数
*/
public static <T, M> DataDaoVo<T> init(List<T> hisitories, List<M> nows, DataDaoKeyConvert<T, M> keyFunc) {
public static <T, M> DataDaoVo<T> init(List<T> hisList, List<M> nowList, DataDaoKeyConvert<T, M> keyFunc) {
DataDaoVo<T> res = new DataDaoVo<T>();
res.add(hisitories, nows, keyFunc);
res.add(hisList, nowList, keyFunc);
return res;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment