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
8f545de9
Commit
8f545de9
authored
Jul 27, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
空值修复
parent
59db1312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
CollectionService.java
...n/java/com/tanpu/community/service/CollectionService.java
+5
-0
No files found.
community-service/src/main/java/com/tanpu/community/service/CollectionService.java
View file @
8f545de9
...
@@ -6,11 +6,13 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
...
@@ -6,11 +6,13 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
import
com.tanpu.community.dao.entity.community.CollectionEntity
;
import
com.tanpu.community.dao.entity.community.CollectionEntity
;
import
com.tanpu.community.dao.entity.community.TimesCountEntity
;
import
com.tanpu.community.dao.entity.community.TimesCountEntity
;
import
com.tanpu.community.dao.mapper.community.CollectionMapper
;
import
com.tanpu.community.dao.mapper.community.CollectionMapper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -83,6 +85,9 @@ public class CollectionService {
...
@@ -83,6 +85,9 @@ public class CollectionService {
// 统计多个对象(主题、评论)的数量(点赞、收藏)
// 统计多个对象(主题、评论)的数量(点赞、收藏)
public
Map
<
String
,
Integer
>
getCountMapByType
(
List
<
String
>
targetIds
,
CollectionTypeEnum
type
)
{
public
Map
<
String
,
Integer
>
getCountMapByType
(
List
<
String
>
targetIds
,
CollectionTypeEnum
type
)
{
if
(
CollectionUtils
.
isEmpty
(
targetIds
)){
return
new
HashMap
<>();
}
LambdaQueryWrapper
<
CollectionEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
CollectionEntity
>().
eq
(
CollectionEntity:
:
getCollectionType
,
1
)
LambdaQueryWrapper
<
CollectionEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
CollectionEntity
>().
eq
(
CollectionEntity:
:
getCollectionType
,
1
)
.
in
(
CollectionEntity:
:
getTargetId
,
targetIds
).
groupBy
(
CollectionEntity:
:
getTargetId
);
.
in
(
CollectionEntity:
:
getTargetId
,
targetIds
).
groupBy
(
CollectionEntity:
:
getTargetId
);
return
collectionMapper
.
selectCountByTargetIds
(
queryWrapper
).
stream
()
return
collectionMapper
.
selectCountByTargetIds
(
queryWrapper
).
stream
()
...
...
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