Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
b973369b
Commit
b973369b
authored
May 05, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表结构修改
parent
fc3b2c85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
DataDaoVo.java
...base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
+11
-8
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
View file @
b973369b
...
...
@@ -55,12 +55,15 @@ public class DataDaoVo<T> {
/**
* 获取结果
*
* @param hisitories 历史数据
* @param mapHistory 历史数据映射
* @param nows
当前数据
* @param keyFunc
获取主键函数
* @return
* @param nows 当前数据
* @param keyFunc 获取主键函数
* @return
返回值
*/
private
void
addResult
(
Map
<
String
,
T
>
mapHistory
,
List
<
T
>
nows
,
DataDaoKey
<
T
>
keyFunc
)
{
private
void
addResult
(
List
<
T
>
hisitories
,
Map
<
String
,
T
>
mapHistory
,
List
<
T
>
nows
,
DataDaoKey
<
T
>
keyFunc
)
{
// 需要删除的集合
List
<
T
>
historyRemove
=
new
ArrayList
<>(
hisitories
);
// 返回集
if
(
nows
!=
null
)
{
for
(
T
now
:
nows
)
{
...
...
@@ -73,7 +76,7 @@ public class DataDaoVo<T> {
this
.
creates
.
add
(
now
);
this
.
mapNow
.
put
(
key
,
now
);
}
else
{
mapHistory
.
remove
(
key
);
historyRemove
.
remove
(
his
);
boolean
isChange
=
keyFunc
.
set
(
his
,
now
);
if
(
isChange
)
{
this
.
updates
.
add
(
his
);
...
...
@@ -82,7 +85,7 @@ public class DataDaoVo<T> {
}
}
}
this
.
removes
.
addAll
(
mapHistory
.
values
()
);
this
.
removes
.
addAll
(
historyRemove
);
}
...
...
@@ -95,7 +98,7 @@ public class DataDaoVo<T> {
*/
public
void
add
(
List
<
T
>
hisitories
,
List
<
T
>
nows
,
DataDaoKey
<
T
>
keyFunc
)
{
Map
<
String
,
T
>
mapHistory
=
getMapHistory
(
hisitories
,
keyFunc
);
addResult
(
mapHistory
,
nows
,
keyFunc
);
addResult
(
hisitories
,
mapHistory
,
nows
,
keyFunc
);
}
...
...
@@ -115,7 +118,7 @@ public class DataDaoVo<T> {
toNows
.
add
(
t
);
}
}
addResult
(
mapHistory
,
toNows
,
keyFunc
);
addResult
(
hisitories
,
mapHistory
,
toNows
,
keyFunc
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment