Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
syncData
Overview
Overview
Details
Activity
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
chenzy
syncData
Commits
b1dcb051
Commit
b1dcb051
authored
Apr 02, 2025
by
chenzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】用户,组织相关
parent
333bd653
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
SyncDataController.java
...n/java/com/keymobile/syncdata/api/SyncDataController.java
+17
-2
No files found.
src/main/java/com/keymobile/syncdata/api/SyncDataController.java
View file @
b1dcb051
...
...
@@ -10,11 +10,13 @@ import com.keymobile.syncdata.service.SyncDataService;
import
jakarta.annotation.Nullable
;
import
org.bson.Document
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.support.PageableExecutionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.*
;
...
...
@@ -96,7 +98,7 @@ public class SyncDataController {
}
@GetMapping
(
"/getUserByOrgId"
)
public
List
<
Document
>
getUserByOrgId
(
@RequestParam
String
orgId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
pageNumber
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
public
Page
<
Document
>
getUserByOrgId
(
@RequestParam
String
orgId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
pageNumber
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
// 查询orgID及其子节点
Queue
<
String
>
queue
=
new
LinkedList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
...
...
@@ -111,9 +113,22 @@ public class SyncDataController {
Query
query
=
new
Query
(
Criteria
.
where
(
"DEPTID"
).
in
(
list
));
query
.
fields
().
exclude
(
"_id"
);
query
.
with
(
org
.
springframework
.
data
.
domain
.
Sort
.
by
(
org
.
springframework
.
data
.
domain
.
Sort
.
Direction
.
ASC
,
"DEPT_ID"
));
Long
total
=
mongoTemplate
.
count
(
query
,
Document
.
class
,
"sync_user_data"
);
Pageable
pageable
=
PageRequest
.
of
(
pageNumber
,
pageSize
);
query
.
with
(
pageable
);
List
<
Document
>
documents
=
mongoTemplate
.
find
(
query
,
Document
.
class
,
"sync_user_data"
);
return
documents
;
return
PageableExecutionUtils
.
getPage
(
documents
,
pageable
,
()
->
total
);
}
@GetMapping
(
"/getAllUser"
)
public
List
<
Document
>
getAllUser
()
{
Query
query
=
new
Query
();
query
.
fields
().
exclude
(
"_id"
);
// query.with(org.springframework.data.domain.Sort.by(org.springframework.data.domain.Sort.Direction.ASC, "DEPT_ID"));
return
null
;
}
}
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