Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
89bd0b57
Commit
89bd0b57
authored
Feb 13, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
话题贡献者列表重新排序
parent
48adc132
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
+16
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
View file @
89bd0b57
...
@@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
...
@@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -555,6 +556,12 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
...
@@ -555,6 +556,12 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
IPage
<
String
>
userIdPage
=
topicMapper
.
selectTopicContributeIdPage
(
new
Page
<>(
pageNumber
,
pageSize
),
topicId
);
IPage
<
String
>
userIdPage
=
topicMapper
.
selectTopicContributeIdPage
(
new
Page
<>(
pageNumber
,
pageSize
),
topicId
);
List
<
String
>
userIds
=
userIdPage
.
getRecords
();
List
<
String
>
userIds
=
userIdPage
.
getRecords
();
int
index
=
0
;
Map
<
String
,
Integer
>
userIdSortMap
=
new
HashMap
<>(
userIds
.
size
());
for
(
int
i
=
0
;
i
<
userIds
.
size
();
i
++)
{
userIdSortMap
.
put
(
userIds
.
get
(
i
),
i
);
}
PageDTO
<
UserFollowDTO
>
userFollowDTOPage
=
new
PageDTO
<>();
PageDTO
<
UserFollowDTO
>
userFollowDTOPage
=
new
PageDTO
<>();
PageUtils
.
copyMeta
(
userIdPage
,
userFollowDTOPage
);
PageUtils
.
copyMeta
(
userIdPage
,
userFollowDTOPage
);
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
...
@@ -569,6 +576,15 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
...
@@ -569,6 +576,15 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
userFollowDTO
.
setFollowedUser
(
false
);
userFollowDTO
.
setFollowedUser
(
false
);
});
});
}
}
// 对列表进行重新排序
Collections
.
sort
(
userInfoDTOList
,
new
Comparator
<
UserFollowDTO
>()
{
@Override
public
int
compare
(
UserFollowDTO
o1
,
UserFollowDTO
o2
)
{
return
userIdSortMap
.
get
(
o1
.
getUserId
())
-
userIdSortMap
.
get
(
o2
.
getUserId
());
}
});
userFollowDTOPage
.
setDataList
(
userInfoDTOList
);
userFollowDTOPage
.
setDataList
(
userInfoDTOList
);
}
else
{
}
else
{
userFollowDTOPage
.
setDataList
(
List
.
of
());
userFollowDTOPage
.
setDataList
(
List
.
of
());
...
...
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