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
2007a13c
Commit
2007a13c
authored
Mar 28, 2024
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
身份证识别
parent
66110f1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+23
-5
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
2007a13c
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.dao.impl;
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.dao.impl;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.dao.cond.SqlCondDefault
;
import
com.yanzuoguang.dao.cond.SqlCondDefault
;
import
com.yanzuoguang.dao.cond.SqlCondEquals
;
import
com.yanzuoguang.dao.cond.SqlCondEquals
;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.util.base.MethodField
;
import
com.yanzuoguang.util.base.MethodField
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.RuntimeCodeException
;
import
com.yanzuoguang.util.exception.RuntimeCodeException
;
...
@@ -12,6 +13,7 @@ import java.util.ArrayList;
...
@@ -12,6 +13,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Consumer
;
import
static
com
.
yanzuoguang
.
dao
.
DaoConst
.*;
import
static
com
.
yanzuoguang
.
dao
.
DaoConst
.*;
...
@@ -880,17 +882,34 @@ public class TableStruct {
...
@@ -880,17 +882,34 @@ public class TableStruct {
*
*
* @param froms 来源数据
* @param froms 来源数据
* @param cls 类型
* @param cls 类型
* @param <T>
* @param <T>
类型
* @return
* @return
返回值
*/
*/
public
static
<
T
extends
GroupAdd
>
List
<
T
>
megerGroupAdd
(
List
<
T
>
froms
,
Class
<
T
>
cls
)
{
public
static
<
T
extends
GroupAdd
>
List
<
T
>
megerGroupAdd
(
List
<
T
>
froms
,
Class
<
T
>
cls
)
{
return
megerGroupAdd
(
cls
,
dbRow
->
{
for
(
T
from
:
froms
)
{
dbRow
.
handle
(
from
);
}
});
}
/**
* 表结构累加
*
* @param cls 类型
* @param consumer 消费类型
* @param <T> 类型
* @return 返回值
*/
public
static
<
T
extends
GroupAdd
>
List
<
T
>
megerGroupAdd
(
Class
<
T
>
cls
,
Consumer
<
DbRow
<
T
>>
consumer
)
{
List
<
T
>
tos
=
new
ArrayList
<>();
List
<
T
>
tos
=
new
ArrayList
<>();
Map
<
String
,
T
>
mapFrom
=
new
HashMap
<>();
Map
<
String
,
T
>
mapFrom
=
new
HashMap
<>();
TableStruct
tableStruct
=
new
TableStruct
(
StringHelper
.
EMPTY
,
cls
);
TableStruct
tableStruct
=
new
TableStruct
(
StringHelper
.
EMPTY
,
cls
);
List
<
TableFieldVo
>
fields
=
tableStruct
.
getGroupLatitudeFields
();
List
<
TableFieldVo
>
fields
=
tableStruct
.
getGroupLatitudeFields
();
for
(
T
from
:
froms
)
{
consumer
.
accept
((
from
)
->
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
TableFieldVo
field
:
fields
)
{
for
(
TableFieldVo
field
:
fields
)
{
String
value
=
StringHelper
.
getFirst
(
ObjectHelper
.
getString
(
from
,
field
.
inputName
));
String
value
=
StringHelper
.
getFirst
(
ObjectHelper
.
getString
(
from
,
field
.
inputName
));
...
@@ -906,10 +925,9 @@ public class TableStruct {
...
@@ -906,10 +925,9 @@ public class TableStruct {
T
history
=
mapFrom
.
get
(
key
);
T
history
=
mapFrom
.
get
(
key
);
history
.
add
(
from
);
history
.
add
(
from
);
}
}
}
}
);
return
tos
;
return
tos
;
}
}
}
}
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