Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
d86eebbe
Commit
d86eebbe
authored
Aug 11, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排序优化
parent
aa1ddd34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
TopicMapper.java
...com/tanpu/community/dao/mapper/community/TopicMapper.java
+1
-1
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+4
-2
No files found.
community-service/src/main/java/com/tanpu/community/dao/mapper/community/TopicMapper.java
View file @
d86eebbe
...
...
@@ -16,6 +16,6 @@ import java.util.List;
* @since 2021-07-22
*/
public
interface
TopicMapper
extends
BaseMapper
<
TopicEntity
>
{
@Select
(
"select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id
de
sc limit #{size}"
)
@Select
(
"select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id
a
sc limit #{size}"
)
List
<
TopicEntity
>
selectGtIdPageable
(
@Param
(
"startId"
)
Long
startId
,
@Param
(
"size"
)
Integer
size
);
}
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
d86eebbe
...
...
@@ -187,8 +187,7 @@ public class RankService {
}
// 记录排序前最新的2个话题
List
<
TopicRankQo
>
newest2Topic
=
topicRankQos
.
stream
().
filter
(
TopicRankQo:
:
judgeNewTopic
).
limit
(
2
).
collect
(
Collectors
.
toList
());
// 排序
List
<
TopicRankQo
>
rankList
=
topicRankQos
.
stream
()
...
...
@@ -201,6 +200,9 @@ public class RankService {
this
.
rankTopicList
=
rankList
;
// 首页推荐话题
// 记录排序前最新的2个话题
List
<
TopicRankQo
>
newest2Topic
=
topicRankQos
.
stream
().
filter
(
TopicRankQo:
:
judgeNewTopic
)
.
sorted
(
Comparator
.
comparing
(
TopicRankQo:
:
getMinutesTillNow
)).
limit
(
2
).
collect
(
Collectors
.
toList
());
List
<
TopicRankQo
>
top4Topic
=
rankList
.
stream
()
.
limit
(
6
)
...
...
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