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
d1466e17
Commit
d1466e17
authored
Jul 26, 2021
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一些问题修正
parent
9a7e35d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
TopicMapper.java
...com/tanpu/community/dao/mapper/community/TopicMapper.java
+6
-1
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+13
-3
VisitSummaryService.java
...java/com/tanpu/community/service/VisitSummaryService.java
+6
-1
No files found.
community-service/src/main/java/com/tanpu/community/dao/mapper/community/TopicMapper.java
View file @
d1466e17
...
@@ -2,6 +2,10 @@ package com.tanpu.community.dao.mapper.community;
...
@@ -2,6 +2,10 @@ package com.tanpu.community.dao.mapper.community;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -12,5 +16,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -12,5 +16,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2021-07-22
* @since 2021-07-22
*/
*/
public
interface
TopicMapper
extends
BaseMapper
<
TopicEntity
>
{
public
interface
TopicMapper
extends
BaseMapper
<
TopicEntity
>
{
@Select
(
"select * from topic where id>#{startId} and delete_tag=0 order by id asc limit #{size}"
)
List
<
TopicEntity
>
selectGtIdPageable
(
@Param
(
"startId"
)
Long
startId
,
@Param
(
"size"
)
Integer
size
);
}
}
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
d1466e17
...
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
...
@@ -14,6 +14,7 @@ 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.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
...
@@ -29,9 +30,18 @@ public class TopicService {
...
@@ -29,9 +30,18 @@ public class TopicService {
private
UuidGenHelper
uuidGenHelper
;
private
UuidGenHelper
uuidGenHelper
;
public
List
<
TopicEntity
>
queryAll
()
{
public
List
<
TopicEntity
>
queryAll
()
{
return
topicMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicEntity
>()
List
<
TopicEntity
>
retList
=
new
ArrayList
<>();
.
eq
(
TopicEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
orderByDesc
(
TopicEntity:
:
getCreateTime
));
Long
lastId
=
0L
;
while
(
true
)
{
List
<
TopicEntity
>
tmpList
=
topicMapper
.
selectGtIdPageable
(
lastId
,
100
);
if
(
tmpList
.
isEmpty
())
{
break
;
}
retList
.
addAll
(
tmpList
);
lastId
=
tmpList
.
stream
().
map
(
TopicEntity:
:
getId
).
max
(
Long:
:
compareTo
).
get
();
}
return
retList
;
}
}
public
List
<
TopicEntity
>
queryByKeyword
(
String
keyword
)
{
public
List
<
TopicEntity
>
queryByKeyword
(
String
keyword
)
{
...
...
community-service/src/main/java/com/tanpu/community/service/VisitSummaryService.java
View file @
d1466e17
package
com
.
tanpu
.
community
.
service
;
package
com
.
tanpu
.
community
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.tanpu.community.api.enums.VisitTypeEnum
;
import
com.tanpu.community.api.enums.VisitTypeEnum
;
import
com.tanpu.community.dao.entity.community.VisitSummaryEntity
;
import
com.tanpu.community.dao.entity.community.VisitSummaryEntity
;
import
com.tanpu.community.dao.mapper.community.VisitSummaryMapper
;
import
com.tanpu.community.dao.mapper.community.VisitSummaryMapper
;
...
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -14,6 +15,7 @@ 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.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -26,7 +28,10 @@ public class VisitSummaryService {
...
@@ -26,7 +28,10 @@ public class VisitSummaryService {
if
(
refIds
.
isEmpty
())
{
if
(
refIds
.
isEmpty
())
{
return
refIds
;
return
refIds
;
}
}
List
<
String
>
visited
=
visitSummaryMapper
.
selectRefIdByUserId
(
userId
,
StringUtils
.
joinWith
(
","
,
refIds
));
List
<
String
>
visited
=
visitSummaryMapper
.
selectList
(
new
LambdaQueryWrapper
<
VisitSummaryEntity
>()
.
eq
(
VisitSummaryEntity:
:
getVisitorId
,
userId
)
.
in
(
VisitSummaryEntity:
:
getRefId
,
refIds
))
.
stream
().
map
(
VisitSummaryEntity:
:
getRefId
).
distinct
().
collect
(
Collectors
.
toList
());
return
ListUtils
.
subtract
(
refIds
,
visited
);
return
ListUtils
.
subtract
(
refIds
,
visited
);
}
}
...
...
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