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
0c9f7e93
Commit
0c9f7e93
authored
Jul 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svc
parent
214a68a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+1
-1
CollectionService.java
...n/java/com/tanpu/community/service/CollectionService.java
+8
-8
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
0c9f7e93
...
...
@@ -232,7 +232,7 @@ public class ThemeManager {
Set
<
String
>
fansSet
=
new
HashSet
<>(
followRelService
.
queryFansByFollowerId
(
userId
));
themeQo
.
setFollow
(
fansSet
.
contains
(
authorId
));
//是否点赞
CollectionEntity
likeEntity
=
collectionService
.
getTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
CollectionEntity
likeEntity
=
collectionService
.
get
NotDelete
TargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
//是否转发
Integer
forwardCountByUser
=
themeService
.
getForwardCountByUser
(
themeId
,
userId
);
...
...
community-service/src/main/java/com/tanpu/community/service/CollectionService.java
View file @
0c9f7e93
...
...
@@ -22,8 +22,8 @@ public class CollectionService {
// 若不存在则新增,若存在则修改deleteTag
public
void
addIfNotExist
(
String
themeId
,
String
userId
,
CollectionTypeEnum
type
)
{
// 判断是否删除
CollectionEntity
queryCollection
=
get
Deleted
TargetCollection
(
themeId
,
userId
,
type
);
// 判断
记录是否存在,无论
是否删除
CollectionEntity
queryCollection
=
getTargetCollection
(
themeId
,
userId
,
type
);
if
(
queryCollection
!=
null
)
{
queryCollection
.
setDeleteTag
(
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
queryCollection
.
setCollectionTime
(
LocalDateTime
.
now
());
...
...
@@ -42,7 +42,7 @@ public class CollectionService {
//根据用户、主题、类型查询未删除对象
public
CollectionEntity
getTargetCollection
(
String
targetId
,
String
userId
,
CollectionTypeEnum
type
)
{
public
CollectionEntity
get
NotDelete
TargetCollection
(
String
targetId
,
String
userId
,
CollectionTypeEnum
type
)
{
return
collectionMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
...
...
@@ -50,18 +50,18 @@ public class CollectionService {
.
eq
(
CollectionEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
()));
}
//根据用户、主题、类型查询已删除对象
public
CollectionEntity
get
Deleted
TargetCollection
(
String
themeId
,
String
userId
,
CollectionTypeEnum
type
)
{
//根据用户、主题、类型查询
记录,包括
已删除对象
public
CollectionEntity
getTargetCollection
(
String
themeId
,
String
userId
,
CollectionTypeEnum
type
)
{
return
collectionMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
.
eq
(
CollectionEntity:
:
getTargetId
,
themeId
)
.
eq
(
CollectionEntity:
:
getDeleteTag
,
DeleteTagEnum
.
DELETED
.
getCode
()));
.
eq
(
CollectionEntity:
:
getTargetId
,
themeId
));
}
// 根据用户id和行为type获取target_id列表
public
Set
<
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
.
toSet
());
...
...
@@ -85,7 +85,7 @@ public class CollectionService {
}
//逻辑删除,修改delete_tag
public
void
delete
(
String
themeId
,
String
userId
,
CollectionTypeEnum
type
)
{
CollectionEntity
queryCollection
=
getTargetCollection
(
themeId
,
userId
,
type
);
CollectionEntity
queryCollection
=
get
NotDelete
TargetCollection
(
themeId
,
userId
,
type
);
if
(
queryCollection
!=
null
)
{
queryCollection
.
setDeleteTag
(
DeleteTagEnum
.
DELETED
.
getCode
());
queryCollection
.
setUncollectionTime
(
LocalDateTime
.
now
());
...
...
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