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
df7fa9e4
Commit
df7fa9e4
authored
Jul 27, 2021
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pageable
parent
4e912b47
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
12 deletions
+7
-12
ThemeListReq.java
...com/tanpu/community/api/beans/req/theme/ThemeListReq.java
+2
-7
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+5
-5
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeListReq.java
View file @
df7fa9e4
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
com.tanpu.community.api.beans.req.page.Pageable
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -21,13 +22,7 @@ public class ThemeListReq {
...
@@ -21,13 +22,7 @@ public class ThemeListReq {
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId,可以为空"
)
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId,可以为空"
)
public
String
lastId
=
""
;
public
String
lastId
=
""
;
@NotNull
(
message
=
"pageNumber不能为空"
)
public
Pageable
page
;
@ApiModelProperty
(
value
=
"页面起始"
)
public
Integer
pageNumber
;
@NotNull
(
message
=
"PageSize不能为空"
)
@ApiModelProperty
(
value
=
"页面大小"
)
public
Integer
pageSize
;
public
List
<
String
>
excludeIds
;
public
List
<
String
>
excludeIds
;
}
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
df7fa9e4
...
@@ -184,8 +184,8 @@ public class ThemeManager {
...
@@ -184,8 +184,8 @@ public class ThemeManager {
*/
*/
// 查询主题列表:推荐/关注/热门/最新
// 查询主题列表:推荐/关注/热门/最新
public
ThemeListResp
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
public
ThemeListResp
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
Integer
pageStart
=
(
req
.
page
Number
-
1
)
*
req
.
pageSize
;
Integer
pageStart
=
(
req
.
page
.
pageNumber
-
1
)
*
req
.
page
.
pageSize
;
Integer
realSize
=
req
.
pageSize
*
2
;
Integer
realSize
=
req
.
page
.
page
Size
*
2
;
List
<
ThemeEntity
>
themes
=
new
ArrayList
<>();
List
<
ThemeEntity
>
themes
=
new
ArrayList
<>();
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
...
@@ -199,7 +199,7 @@ public class ThemeManager {
...
@@ -199,7 +199,7 @@ public class ThemeManager {
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//根据关注列表查询
//根据关注列表查询
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
themes
=
themeService
.
queryByUserIds
(
fansList
,
req
.
getLastId
(),
req
.
getPageSize
());
themes
=
themeService
.
queryByUserIds
(
fansList
,
req
.
getLastId
(),
req
.
page
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
//根据话题查询热门
//根据话题查询热门
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
{
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
{
...
@@ -216,13 +216,13 @@ public class ThemeManager {
...
@@ -216,13 +216,13 @@ public class ThemeManager {
throw
new
BizException
(
"TopicId为空"
);
throw
new
BizException
(
"TopicId为空"
);
}
}
themes
=
themeService
.
queryNewestByTopic
(
req
.
topicId
,
req
.
pageNumber
,
realSize
);
themes
=
themeService
.
queryNewestByTopic
(
req
.
topicId
,
req
.
page
.
page
Number
,
realSize
);
}
}
// filter用户自己的
// filter用户自己的
themes
=
themes
.
stream
().
filter
(
t
->
{
themes
=
themes
.
stream
().
filter
(
t
->
{
return
!
userId
.
equals
(
t
.
getAuthorId
())
&&
!
req
.
excludeIds
.
contains
(
t
.
getThemeId
());
return
!
userId
.
equals
(
t
.
getAuthorId
())
&&
!
req
.
excludeIds
.
contains
(
t
.
getThemeId
());
}).
collect
(
Collectors
.
toList
()).
subList
(
0
,
req
.
pageSize
);
}).
collect
(
Collectors
.
toList
()).
subList
(
0
,
req
.
page
.
page
Size
);
ThemeListResp
resp
=
new
ThemeListResp
();
ThemeListResp
resp
=
new
ThemeListResp
();
resp
.
excludeIds
=
req
.
excludeIds
;
resp
.
excludeIds
=
req
.
excludeIds
;
...
...
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