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
bb085955
Commit
bb085955
authored
Aug 03, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的帖子列表加载时间过长 fix
parent
869d830d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
65 deletions
+3
-65
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+1
-1
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+2
-64
No files found.
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
bb085955
...
...
@@ -109,7 +109,7 @@ public class CommentService {
CommentEntity
commentEntity
=
commentMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CommentEntity
>()
.
eq
(
CommentEntity:
:
getCommentId
,
lastId
));
if
(
commentEntity
==
null
)
throw
new
BizException
(
"评论未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
CommentEntity:
:
get
Upd
ateTime
,
commentEntity
.
getCreateTime
());
queryWrapper
.
lt
(
CommentEntity:
:
get
Cre
ateTime
,
commentEntity
.
getCreateTime
());
}
if
(
pageSize
!=
null
)
{
queryWrapper
.
last
(
"limit "
+
pageSize
);
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
bb085955
...
...
@@ -80,12 +80,11 @@ public class ThemeService {
public
List
<
ThemeEntity
>
queryThemesByUserId
(
String
userId
,
String
lastId
,
Integer
pageSize
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getAuthorId
,
userId
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
orderByDesc
(
ThemeEntity:
:
getId
);
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryByThemeId
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
get
Upd
ateTime
,
lastEntity
.
getCreateTime
());
queryWrapper
.
lt
(
ThemeEntity:
:
get
Cre
ateTime
,
lastEntity
.
getCreateTime
());
}
if
(
pageSize
!=
null
)
{
queryWrapper
.
last
(
"limit "
+
pageSize
);
...
...
@@ -104,7 +103,7 @@ public class ThemeService {
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryByThemeId
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
get
Upd
ateTime
,
lastEntity
.
getCreateTime
());
queryWrapper
.
lt
(
ThemeEntity:
:
get
Cre
ateTime
,
lastEntity
.
getCreateTime
());
}
if
(
pageSize
!=
null
)
{
queryWrapper
.
last
(
"limit "
+
pageSize
);
...
...
@@ -130,67 +129,6 @@ public class ThemeService {
}
/**
* 查询非传入作者的主题(可分页)
*
* @param lastId
* @param pageSize
* @param userId
* @return
*/
public
List
<
ThemeEntity
>
selectExcludeUser
(
String
userId
,
String
lastId
,
Integer
pageSize
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(!
StringUtils
.
isEmpty
(
userId
))
{
queryWrapper
.
ne
(
ThemeEntity:
:
getAuthorId
,
userId
);
}
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryByThemeId
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getCreateTime
());
}
if
(
pageSize
!=
null
)
{
queryWrapper
.
last
(
"limit "
+
pageSize
);
}
queryWrapper
.
orderByDesc
(
ThemeEntity:
:
getId
);
queryWrapper
.
orderByDesc
(
ThemeEntity:
:
getCreateTime
);
queryWrapper
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
return
themeMapper
.
selectList
(
queryWrapper
);
}
/**
* 查询非传入作者的主题(可分页)
*
* @param lastId
* @param pageSize
* @param userId
* @return
*/
public
List
<
ThemeEntity
>
queryByThemeIdsExcludeUser
(
List
<
String
>
themeIds
,
String
userId
,
String
lastId
,
Integer
pageSize
)
{
if
(
CollectionUtils
.
isEmpty
(
themeIds
))
{
return
Collections
.
emptyList
();
}
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
in
(
ThemeEntity:
:
getThemeId
,
themeIds
);
if
(!
StringUtils
.
isEmpty
(
userId
))
{
queryWrapper
.
ne
(
ThemeEntity:
:
getAuthorId
,
userId
);
}
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryByThemeId
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getCreateTime
());
}
if
(
pageSize
!=
null
)
{
queryWrapper
.
last
(
"limit "
+
pageSize
);
}
queryWrapper
.
orderByDesc
(
ThemeEntity:
:
getId
);
queryWrapper
.
orderByDesc
(
ThemeEntity:
:
getCreateTime
);
queryWrapper
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
return
themeMapper
.
selectList
(
queryWrapper
);
}
/**
...
...
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