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
16b5ae0a
Commit
16b5ae0a
authored
Jul 28, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的帖子列表按照收藏时间排序
parent
eed45154
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
+18
-6
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+1
-1
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+7
-4
CollectionService.java
...n/java/com/tanpu/community/service/CollectionService.java
+10
-1
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
16b5ae0a
...
...
@@ -69,7 +69,7 @@ public class CommentManager {
List
<
CommentEntity
>
commentEntities
=
commentService
.
selectByThemeId
(
themeId
);
List
<
CommentQo
>
commentQos
=
ConvertUtil
.
commentEntity2Qos
(
commentEntities
);
Set
<
String
>
likeCommentList
=
collectionService
.
get
Lis
tByUser
(
userId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
Set
<
String
>
likeCommentList
=
collectionService
.
get
Se
tByUser
(
userId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
for
(
CommentQo
commentQo
:
commentQos
)
{
//查询用户信息
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
16b5ae0a
...
...
@@ -313,12 +313,15 @@ public class ThemeManager {
List
<
ThemeQo
>
commentThemeList
=
getCommentThemeQos
(
req
,
userId
);
return
commentThemeList
;
case
3
:
//点赞
Set
<
String
>
likeThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
LIKE_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
likeThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
List
<
String
>
likeThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
LIKE_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
likeThemeIds
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
likeThemeIds
);
break
;
case
4
:
//收藏
Set
<
String
>
collectThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
COLLECT_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
collectThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
List
<
String
>
collectThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
COLLECT_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
collectThemeIds
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
collectThemeIds
);
break
;
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
...
...
community-service/src/main/java/com/tanpu/community/service/CollectionService.java
View file @
16b5ae0a
...
...
@@ -66,7 +66,7 @@ public class CollectionService {
}
// 根据用户id和行为type获取target_id列表
public
Set
<
String
>
get
Lis
tByUser
(
String
userId
,
CollectionTypeEnum
type
)
{
public
Set
<
String
>
get
Se
tByUser
(
String
userId
,
CollectionTypeEnum
type
)
{
return
collectionMapper
.
selectList
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
...
...
@@ -74,6 +74,15 @@ public class CollectionService {
.
stream
().
map
(
CollectionEntity:
:
getTargetId
).
collect
(
Collectors
.
toSet
());
}
// 根据用户id和行为type获取target_id列表
public
List
<
String
>
getListByUser
(
String
userId
,
CollectionTypeEnum
type
)
{
return
collectionMapper
.
selectList
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
.
eq
(
CollectionEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
()))
.
stream
().
map
(
CollectionEntity:
:
getTargetId
).
collect
(
Collectors
.
toList
());
}
// 统计单个对象(主题、评论)的数量(点赞、收藏)
public
Integer
getCountByTypeAndId
(
String
targetId
,
CollectionTypeEnum
type
)
{
...
...
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