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
49e22e2c
Commit
49e22e2c
authored
Nov 04, 2024
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
身份证识别
parent
d8109d6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
ArrayHelper.java
...rc/main/java/com/yanzuoguang/util/helper/ArrayHelper.java
+21
-0
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+4
-3
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/ArrayHelper.java
View file @
49e22e2c
...
@@ -118,6 +118,27 @@ public class ArrayHelper {
...
@@ -118,6 +118,27 @@ public class ArrayHelper {
}
}
return
list
;
return
list
;
}
}
/**
* 获取对象为对象列表
*
* @param val 需要获取的对象,可以为List或者Array或者其他对象.
* @return
*/
public
static
List
getCollection
(
Object
val
)
{
boolean
isArray
=
isArrayOrList
(
val
);
List
list
;
// 判断处理
if
(
val
instanceof
List
)
{
list
=
(
List
)
val
;
}
else
if
(
isArray
)
{
Object
[]
arr
=
(
Object
[])
val
;
list
=
Arrays
.
asList
(
arr
);
}
else
{
list
=
new
ArrayList
();
list
.
add
(
val
);
}
return
list
;
}
/**
/**
* 将数组添加到列表中
* 将数组添加到列表中
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
49e22e2c
...
@@ -735,13 +735,13 @@ public abstract class BaseDaoSql {
...
@@ -735,13 +735,13 @@ public abstract class BaseDaoSql {
* @return 获取包含列表的SQL语句的值
* @return 获取包含列表的SQL语句的值
*/
*/
private
String
getListSql
(
List
<
Object
>
paras
,
String
sql
,
String
name
,
Object
val
)
{
private
String
getListSql
(
List
<
Object
>
paras
,
String
sql
,
String
name
,
Object
val
)
{
List
list
=
ArrayHelper
.
getList
(
val
);
Collection
list
=
ArrayHelper
.
getCollection
(
val
);
int
length
=
list
.
size
();
int
length
=
list
.
size
();
// 进行循环
// 进行循环
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
int
i
=
0
;
Object
item
=
list
.
get
(
i
);
for
(
Object
item
:
list
)
{
// 判断列表是否为常规对象
// 判断列表是否为常规对象
if
(
item
==
null
||
item
instanceof
Number
||
item
.
getClass
().
isEnum
()
||
item
instanceof
String
||
item
instanceof
Date
)
{
if
(
item
==
null
||
item
instanceof
Number
||
item
.
getClass
().
isEnum
()
||
item
instanceof
String
||
item
instanceof
Date
)
{
addArrayIn
(
paras
,
sb
,
i
,
item
);
addArrayIn
(
paras
,
sb
,
i
,
item
);
...
@@ -750,6 +750,7 @@ public abstract class BaseDaoSql {
...
@@ -750,6 +750,7 @@ public abstract class BaseDaoSql {
}
else
{
}
else
{
addArrayTable
(
paras
,
sb
,
i
,
item
);
addArrayTable
(
paras
,
sb
,
i
,
item
);
}
}
i
++;
}
}
// 生成最终的SQL语句
// 生成最终的SQL语句
...
...
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