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
5ef19976
Commit
5ef19976
authored
Jul 06, 2020
by
董建华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量查询
parent
2e2da97a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
6 deletions
+49
-6
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+2
-6
UserController.java
...oup/xyqb/controller/middleoffice/user/UserController.java
+18
-0
IUserRepository.java
...n/java/cn/quantgroup/xyqb/repository/IUserRepository.java
+2
-0
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+8
-0
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+19
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
5ef19976
...
...
@@ -76,14 +76,10 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.http.HttpStatus
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.messaging.handler.annotation.Header
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.constraints.Min
;
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/user/UserController.java
View file @
5ef19976
...
...
@@ -3,9 +3,12 @@ package cn.quantgroup.xyqb.controller.middleoffice.user;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
org.springframework.messaging.handler.annotation.Header
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户信息
...
...
@@ -63,5 +66,20 @@ public class UserController {
//TODO convert to userVO
return
JsonResult
.
buildSuccessResultGeneric
(
user
);
}
/**
* 根据uuid或者userids 获取用户信息
* @param params
* @return
*/
@PostMapping
(
"/getByUuidsOrUserIds"
)
public
JsonResult
getByUuidsOrUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
){
List
<
String
>
vals
=
(
List
<
String
>)
params
.
get
(
"vals"
);
Integer
type
=
(
Integer
)
params
.
get
(
"type"
);
if
(
type
==
null
||
(
type
!=
1
&&
type
!=
2
)){
return
JsonResult
.
buildErrorStateResult
(
"type错误"
,
null
);
}
return
JsonResult
.
buildSuccessResultGeneric
(
userService
.
findByUuidsOrUserIds
(
vals
,
type
));
}
}
src/main/java/cn/quantgroup/xyqb/repository/IUserRepository.java
View file @
5ef19976
...
...
@@ -49,4 +49,6 @@ public interface IUserRepository extends JpaRepository<User, Long>, JpaSpecifica
List
<
User
>
findByIdBetween
(
Long
id
,
Long
endId
);
List
<
User
>
findByUuidIn
(
List
<
String
>
uuids
);
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
5ef19976
...
...
@@ -85,4 +85,12 @@ public interface IUserService {
* @return
*/
UserFullResp
findUserFullSearchByUserId
(
Long
userId
);
/**
* 按照userid 或者 uuid 批量查询
* @param vals
* @param type
* @return
*/
List
<
User
>
findByUuidsOrUserIds
(
List
<
String
>
vals
,
Integer
type
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
5ef19976
...
...
@@ -56,6 +56,7 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
* Created by Miraculous on 15/7/5.
...
...
@@ -412,4 +413,22 @@ public class UserServiceImpl implements IUserService, IBaseController {
userFullResp
.
setContacts
(
contacts
);
return
userFullResp
;
}
@Override
public
List
<
User
>
findByUuidsOrUserIds
(
List
<
String
>
vals
,
Integer
type
)
{
if
(
CollectionUtils
.
isEmpty
(
vals
))
{
return
Collections
.
EMPTY_LIST
;
}
if
(
type
==
1
)
{
//1是userids
List
<
Long
>
collect
=
vals
.
stream
()
.
map
(
Long:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
return
userRepository
.
findByIdIn
(
collect
);
}
else
{
//不是1 就是 uuids
return
userRepository
.
findByUuidIn
(
vals
);
}
}
}
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