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
3294a9d0
Commit
3294a9d0
authored
Jan 13, 2017
by
lee_mingzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加客服根据条件查询用户详情的相关方法
parent
34c33f50
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+7
-0
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+5
-0
IUserDetailService.java
...a/cn/quantgroup/xyqb/service/user/IUserDetailService.java
+4
-0
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+32
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
3294a9d0
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.List
;
/**
/**
* Created by Miraculous on 2016/12/19.
* Created by Miraculous on 2016/12/19.
...
@@ -187,4 +188,10 @@ public class InnerController {
...
@@ -187,4 +188,10 @@ public class InnerController {
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
@RequestMapping
(
"/user_detail/search_list"
)
public
JsonResult
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
List
<
UserDetail
>
userDetails
=
userDetailService
.
searchUserDetailList
(
name
,
phoneNo
,
idNo
);
return
JsonResult
.
buildSuccessResult
(
"success"
,
userDetails
);
}
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
3294a9d0
package
cn
.
quantgroup
.
xyqb
.
repository
;
package
cn
.
quantgroup
.
xyqb
.
repository
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
/**
* @author mengfan.feng
* @author mengfan.feng
* @time 2015-09-11 11:22
* @time 2015-09-11 11:22
...
@@ -21,4 +24,6 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long> {
...
@@ -21,4 +24,6 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long> {
@Query
(
value
=
"update user_detail set qq = ?1 where user_id = ?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"update user_detail set qq = ?1 where user_id = ?2"
,
nativeQuery
=
true
)
void
updateUserQQ
(
String
qq
,
Long
userId
);
void
updateUserQQ
(
String
qq
,
Long
userId
);
List
<
UserDetail
>
findAll
(
Specification
<
UserDetail
>
specification
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserDetailService.java
View file @
3294a9d0
...
@@ -2,6 +2,8 @@ package cn.quantgroup.xyqb.service.user;
...
@@ -2,6 +2,8 @@ package cn.quantgroup.xyqb.service.user;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
java.util.List
;
/**
/**
* Created by 11 on 2016/12/29.
* Created by 11 on 2016/12/29.
*/
*/
...
@@ -13,4 +15,6 @@ public interface IUserDetailService {
...
@@ -13,4 +15,6 @@ public interface IUserDetailService {
UserDetail
findByPhoneNo
(
String
phoneNo
);
UserDetail
findByPhoneNo
(
String
phoneNo
);
void
updateUserQQ
(
Long
userId
,
String
qq
);
void
updateUserQQ
(
Long
userId
,
String
qq
);
List
<
UserDetail
>
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
3294a9d0
...
@@ -3,9 +3,14 @@ package cn.quantgroup.xyqb.service.user.impl;
...
@@ -3,9 +3,14 @@ package cn.quantgroup.xyqb.service.user.impl;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.criteria.*
;
import
java.util.List
;
/**
/**
* Created by 11 on 2016/12/29.
* Created by 11 on 2016/12/29.
*/
*/
...
@@ -34,4 +39,31 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -34,4 +39,31 @@ public class UserDetailServiceImpl implements IUserDetailService {
public
void
updateUserQQ
(
Long
userId
,
String
qq
)
{
public
void
updateUserQQ
(
Long
userId
,
String
qq
)
{
userDetailRepository
.
updateUserQQ
(
qq
,
userId
);
userDetailRepository
.
updateUserQQ
(
qq
,
userId
);
}
}
@Override
public
List
<
UserDetail
>
searchUserDetailList
(
String
name
,
String
phoneNo
,
String
idNo
)
{
return
userDetailRepository
.
findAll
(
getSpecification
(
name
,
phoneNo
,
idNo
));
}
private
Specification
<
UserDetail
>
getSpecification
(
String
name
,
String
phoneNo
,
String
idNo
)
{
Specification
<
UserDetail
>
specification
=
new
Specification
<
UserDetail
>()
{
@Override
public
Predicate
toPredicate
(
Root
<
UserDetail
>
root
,
CriteriaQuery
<?>
criteriaQuery
,
CriteriaBuilder
criteriaBuilder
)
{
if
(!
StringUtils
.
isEmpty
(
name
))
{
Path
<
String
>
namePath
=
root
.
get
(
"name"
);
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
namePath
,
name
));
}
if
(!
StringUtils
.
isEmpty
(
phoneNo
))
{
Path
<
String
>
phonePath
=
root
.
get
(
"phoneNo"
);
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
phonePath
,
phoneNo
));
}
if
(!
StringUtils
.
isEmpty
(
idNo
))
{
Path
<
String
>
idNoPath
=
root
.
get
(
"idNo"
);
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
idNoPath
,
idNo
));
}
return
null
;
}
};
return
specification
;
}
}
}
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