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
da705be1
Commit
da705be1
authored
Jul 27, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
e6f3a7db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+28
-1
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+2
-3
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
da705be1
...
...
@@ -66,6 +66,32 @@ public class StringHelper {
return
false
;
}
/**
* 是否属于空数组
*
* @param val
* @return
*/
public
static
boolean
isEmptyArray
(
Object
val
)
{
if
(
val
==
null
)
{
return
true
;
}
boolean
isArray
=
val
instanceof
List
||
val
.
getClass
().
isArray
();
if
(!
isArray
)
{
return
false
;
}
List
list
;
// 判断处理
if
(
val
instanceof
List
)
{
list
=
(
List
)
val
;
}
else
{
Object
[]
arr
=
(
Object
[])
val
;
list
=
Arrays
.
asList
(
arr
);
}
int
length
=
list
.
size
();
return
length
==
0
;
}
/**
* 判断字符串是否为空
*
...
...
@@ -196,7 +222,7 @@ public class StringHelper {
if
(
(
chars
[
start
+
1
]
==
'x'
)
||
(
chars
[
start
+
1
]
==
'X'
)
)
{
// leading 0x/0X
)
{
// leading 0x/0X
int
i
=
start
+
2
;
if
(
i
==
sz
)
{
// str == "0x"
...
...
@@ -1021,4 +1047,5 @@ public class StringHelper {
return
from
;
}
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
da705be1
...
...
@@ -485,7 +485,7 @@ public abstract class BaseDaoSql {
// 进行SQL语句参数替换,后面增加一个空格,方便后续用正则表达式进行替换处理
sql
=
sql
.
replaceFirst
(
"\\?"
,
"@"
+
field
.
paraName
+
" "
);
}
if
(
isCond
&&
StringHelper
.
isEmpty
(
val
))
{
if
(
isCond
&&
(
StringHelper
.
isEmpty
(
val
)
||
StringHelper
.
isEmptyArray
(
val
)
))
{
continue
;
}
}
...
...
@@ -566,8 +566,7 @@ public abstract class BaseDaoSql {
List
list
;
// 判断处理
boolean
isList
=
val
instanceof
List
;
if
(
isList
)
{
if
(
val
instanceof
List
)
{
list
=
(
List
)
val
;
}
else
{
Object
[]
arr
=
(
Object
[])
val
;
...
...
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