Commit e3fd5a3f authored by yanzg's avatar yanzg

表结构修改

parent b973369b
...@@ -32,16 +32,16 @@ public class DataDaoVo<T> { ...@@ -32,16 +32,16 @@ public class DataDaoVo<T> {
/** /**
* 将历史数据映射为HashMap * 将历史数据映射为HashMap
* *
* @param hisitories 历史数据 * @param hisList 历史数据
* @param keyFunc  获取主键函数 * @param keyFunc 获取主键函数
* @return * @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); Map<String, T> mapHistory = new HashMap<>(10);
// 历史数据处理 // 历史数据处理
if (hisitories != null) { if (hisList != null) {
for (T his : hisitories) { for (T his : hisList) {
if (his == null) { if (his == null) {
continue; continue;
} }
...@@ -55,18 +55,17 @@ public class DataDaoVo<T> { ...@@ -55,18 +55,17 @@ public class DataDaoVo<T> {
/** /**
* 获取结果 * 获取结果
* *
* @param hisitories 历史数据 * @param hisList 历史数据
* @param mapHistory 历史数据映射 * @param mapHistory 历史数据映射
* @param nows 当前数据 * @param nowList 当前数据
* @param keyFunc 获取主键函数 * @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) { if (nowList != null) {
for (T now : nows) { for (T now : nowList) {
if (now == null) { if (now == null) {
continue; continue;
} }
...@@ -92,45 +91,45 @@ public class DataDaoVo<T> { ...@@ -92,45 +91,45 @@ public class DataDaoVo<T> {
/** /**
* 初始话对象 * 初始话对象
* *
* @param hisitories * @param hisList 历史列表
* @param nows * @param nowList 当前列表
* @param keyFunc * @param keyFunc 函数
*/ */
public void add(List<T> hisitories, List<T> nows, DataDaoKey<T> keyFunc) { public void add(List<T> hisList, List<T> nowList, DataDaoKey<T> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisitories, keyFunc); Map<String, T> mapHistory = getMapHistory(hisList, keyFunc);
addResult(hisitories, mapHistory, nows, keyFunc); addResult(hisList, mapHistory, nowList, keyFunc);
} }
/** /**
* 初始话对象 * 初始话对象
* *
* @param hisitories * @param hisList 历史列表
* @param nows * @param nowList 当前列表
* @param keyFunc * @param keyFunc 处理函数
*/ */
public <M> void add(List<T> hisitories, List<M> nows, DataDaoKeyConvert<T, M> keyFunc) { public <M> void add(List<T> hisList, List<M> nowList, DataDaoKeyConvert<T, M> keyFunc) {
Map<String, T> mapHistory = getMapHistory(hisitories, keyFunc); Map<String, T> mapHistory = getMapHistory(hisList, keyFunc);
List<T> toNows = new ArrayList<>(10); List<T> nowListTo = new ArrayList<>(10);
if (nows != null) { if (nowList != null) {
for (M m : nows) { for (M m : nowList) {
T t = keyFunc.convert(mapHistory, m); 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 hisList 历史列表
* @param nows * @param nowList 当前列表
* @param keyFunc * @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>(); DataDaoVo<T> res = new DataDaoVo<T>();
res.add(hisitories, nows, keyFunc); res.add(hisList, nowList, keyFunc);
return res; return res;
} }
...@@ -138,13 +137,13 @@ public class DataDaoVo<T> { ...@@ -138,13 +137,13 @@ public class DataDaoVo<T> {
/** /**
* 初始话对象 * 初始话对象
* *
* @param hisitories * @param hisList 历史列表
* @param nows * @param nowList 当前列表
* @param keyFunc * @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>(); DataDaoVo<T> res = new DataDaoVo<T>();
res.add(hisitories, nows, keyFunc); res.add(hisList, nowList, keyFunc);
return res; 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