Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
1ec96cf6
Commit
1ec96cf6
authored
Jul 27, 2018
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix : 只能equals
parent
15d2f3ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+6
-18
No files found.
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
1ec96cf6
...
...
@@ -123,26 +123,14 @@ public class UserDetailServiceImpl implements IUserDetailService {
private
Specification
<
UserDetail
>
getSpecification
(
String
name
,
String
phoneNo
,
String
idNo
)
{
List
<
Predicate
>
list
=
new
ArrayList
<>();
Specification
<
UserDetail
>
specification
=
(
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
if
(
ValidationUtil
.
validatePhoneNo
(
phoneNo
)){
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
Constants
.
PHONE_NO
).
as
(
String
.
class
),
phoneNo
));
}
else
if
(
StringUtils
.
isNotBlank
(
phoneNo
))
{
if
(
phoneNo
.
length
()
<
9
)
{
log
.
error
(
"哪个傻逼用这么少的数字查. phoneNo:{}"
,
phoneNo
);
throw
new
RuntimeException
(
"not_allowed"
);
}
if
(!
StringUtils
.
isEmpty
(
name
))
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"name"
).
as
(
String
.
class
),
name
));
}
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
if
(
Objects
.
equals
(
Constants
.
IDNO_LENGTH
,
idNo
.
length
())){
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"idNo"
).
as
(
String
.
class
),
idNo
));
}
else
{
if
(
idNo
.
length
()
<
16
)
{
log
.
error
(
"哪个傻逼用这么少的数字查. idNo:{}"
,
idNo
);
throw
new
RuntimeException
(
"not_allowed"
);
}
}
if
(!
StringUtils
.
isEmpty
(
phoneNo
))
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
Constants
.
PHONE_NO
).
as
(
String
.
class
),
phoneNo
));
}
if
(
StringUtils
.
isNotBlank
(
name
))
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"
name"
).
as
(
String
.
class
),
name
));
if
(
!
StringUtils
.
isEmpty
(
idNo
))
{
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"
idNo"
).
as
(
String
.
class
),
idNo
));
}
Predicate
[]
p
=
new
Predicate
[
list
.
size
()];
return
criteriaBuilder
.
and
(
list
.
toArray
(
p
));
...
...
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