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
fa6f1bc6
Commit
fa6f1bc6
authored
May 06, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口文档的支持
parent
dacd0830
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
1 deletion
+116
-1
DataDaoKey.java
...ase/src/main/java/com/yanzuoguang/util/vo/DataDaoKey.java
+25
-0
DataDaoVo.java
...base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
+90
-0
ExportColumn.java
...-db/src/main/java/com/yanzuoguang/excel/ExportColumn.java
+1
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/DataDaoKey.java
0 → 100644
View file @
fa6f1bc6
package
com
.
yanzuoguang
.
util
.
vo
;
/**
* 获取关键字
*
* @param <T>
* @author 颜佐光
*/
public
interface
DataDaoKey
<
T
extends
Object
>
{
/**
* 获取关键字
*
* @param from 来源对象
* @return
*/
String
getKey
(
T
from
);
/**
* 将当前对象的属性,写入到历史对象中,用于更新函数
*
* @param history
* @param now
*/
void
set
(
T
history
,
T
now
);
}
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
0 → 100644
View file @
fa6f1bc6
package
com
.
yanzuoguang
.
util
.
vo
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 数据库操作对象
*
* @param <T>
* @author 颜佐光
*/
public
class
DataDaoVo
<
T
>
{
private
List
<
T
>
creates
=
new
ArrayList
<>();
private
List
<
T
>
updates
=
new
ArrayList
<>();
private
List
<
T
>
removes
=
new
ArrayList
<>();
private
Map
<
String
,
T
>
mapNow
=
new
HashMap
<>();
/**
* 初始话对象
*
* @param hisitories
* @param nows
* @param keyFunc
*/
public
<
T
>
DataDaoVo
<
T
>
init
(
List
<
T
>
hisitories
,
List
<
T
>
nows
,
DataDaoKey
<
T
>
keyFunc
)
{
Map
<
String
,
T
>
mapHistory
=
new
HashMap
<>((
hisitories
.
size
()
+
nows
.
size
())
/
2
);
// 历史数据处理
for
(
T
his
:
hisitories
)
{
String
key
=
keyFunc
.
getKey
(
his
);
T
t
=
mapHistory
.
get
(
key
);
mapHistory
.
put
(
key
,
t
);
}
DataDaoVo
<
T
>
res
=
new
DataDaoVo
<
T
>();
// 返回集
for
(
T
now
:
nows
)
{
String
key
=
keyFunc
.
getKey
(
now
);
T
his
=
mapHistory
.
get
(
key
);
if
(
his
==
null
)
{
res
.
creates
.
add
(
now
);
res
.
mapNow
.
put
(
key
,
now
);
}
else
{
keyFunc
.
set
(
his
,
now
);
res
.
updates
.
add
(
his
);
res
.
mapNow
.
put
(
key
,
his
);
}
}
res
.
removes
.
addAll
(
mapHistory
.
values
());
return
res
;
}
/**
* 需要创建的对象
*
* @return
*/
public
List
<
T
>
getCreates
()
{
return
creates
;
}
/**
* 需要修改的对象
*
* @return
*/
public
List
<
T
>
getUpdates
()
{
return
updates
;
}
/**
* 需要删除的对象
*
* @return
*/
public
List
<
T
>
getRemoves
()
{
return
removes
;
}
/**
* 所有需要修改和更新的对象
*
* @return
*/
public
Map
<
String
,
T
>
getMapNow
()
{
return
mapNow
;
}
}
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExportColumn.java
View file @
fa6f1bc6
...
...
@@ -38,7 +38,7 @@ public class ExportColumn {
/**
* 宽度
*/
@ApiModelProperty
(
notes
=
"
列标题,如 A.B
"
)
@ApiModelProperty
(
notes
=
"
宽度
"
)
private
short
width
;
public
String
getTitle
()
{
...
...
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