Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
44d740b7
H
halo
项目概览
IEQEFCR
/
halo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
halo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
44d740b7
编写于
10月 29, 2021
作者:
扶
扶醉
提交者:
GitHub
10月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix number of comment in detail of post and sheet and add it into detail of journal (#1503)
上级
0a137136
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
40 addition
and
8 deletion
+40
-8
src/main/java/run/halo/app/controller/content/api/JournalController.java
...un/halo/app/controller/content/api/JournalController.java
+1
-1
src/main/java/run/halo/app/repository/base/BaseCommentRepository.java
...a/run/halo/app/repository/base/BaseCommentRepository.java
+9
-0
src/main/java/run/halo/app/service/JournalService.java
src/main/java/run/halo/app/service/JournalService.java
+3
-3
src/main/java/run/halo/app/service/base/BaseCommentService.java
...in/java/run/halo/app/service/base/BaseCommentService.java
+9
-0
src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java
...ava/run/halo/app/service/impl/BaseCommentServiceImpl.java
+6
-0
src/main/java/run/halo/app/service/impl/JournalServiceImpl.java
...in/java/run/halo/app/service/impl/JournalServiceImpl.java
+8
-2
src/main/java/run/halo/app/service/impl/PostServiceImpl.java
src/main/java/run/halo/app/service/impl/PostServiceImpl.java
+2
-1
src/main/java/run/halo/app/service/impl/SheetServiceImpl.java
...main/java/run/halo/app/service/impl/SheetServiceImpl.java
+2
-1
未找到文件。
src/main/java/run/halo/app/controller/content/api/JournalController.java
浏览文件 @
44d740b7
...
...
@@ -71,7 +71,7 @@ public class JournalController {
@GetMapping
(
"{journalId:\\d+}"
)
@ApiOperation
(
"Gets a journal detail"
)
public
JournalDTO
getBy
(
@PathVariable
(
"journalId"
)
Integer
journalId
)
{
public
Journal
WithCmtCount
DTO
getBy
(
@PathVariable
(
"journalId"
)
Integer
journalId
)
{
Journal
journal
=
journalService
.
getById
(
journalId
);
return
journalService
.
convertTo
(
journal
);
}
...
...
src/main/java/run/halo/app/repository/base/BaseCommentRepository.java
浏览文件 @
44d740b7
...
...
@@ -99,6 +99,15 @@ public interface BaseCommentRepository<COMMENT extends BaseComment>
*/
long
countByPostId
(
@NonNull
Integer
postId
);
/**
* Count comments by comment status and post id.
*
* @param status status must not be null
* @param postId post id must not be null.
* @return comments count
*/
long
countByStatusAndPostId
(
@NonNull
CommentStatus
status
,
@NonNull
Integer
postId
);
/**
* Counts by comment status.
*
...
...
src/main/java/run/halo/app/service/JournalService.java
浏览文件 @
44d740b7
...
...
@@ -68,13 +68,13 @@ public interface JournalService extends CrudService<Journal, Integer> {
Page
<
Journal
>
pageBy
(
@NonNull
JournalType
type
,
@NonNull
Pageable
pageable
);
/**
* Converts to journal dto.
* Converts to journal
with comment count
dto.
*
* @param journal journal must not be null
* @return journal dto
* @return journal
with comment count
dto
*/
@NonNull
JournalDTO
convertTo
(
@NonNull
Journal
journal
);
Journal
WithCmtCount
DTO
convertTo
(
@NonNull
Journal
journal
);
/**
* Converts to journal with comment count dto list.
...
...
src/main/java/run/halo/app/service/base/BaseCommentService.java
浏览文件 @
44d740b7
...
...
@@ -144,6 +144,15 @@ public interface BaseCommentService<COMMENT extends BaseComment>
*/
long
countByPostId
(
@NonNull
Integer
postId
);
/**
* Count comments by comment status and post id.
*
* @param status status must not be null.
* @param postId post id must not be null.
* @return comments count
*/
long
countByStatusAndPostId
(
@NonNull
CommentStatus
status
,
@NonNull
Integer
postId
);
/**
* Counts by comment status.
*
...
...
src/main/java/run/halo/app/service/impl/BaseCommentServiceImpl.java
浏览文件 @
44d740b7
...
...
@@ -290,6 +290,12 @@ public abstract class BaseCommentServiceImpl<COMMENT extends BaseComment>
return
baseCommentRepository
.
countByPostId
(
postId
);
}
@Override
public
long
countByStatusAndPostId
(
@NonNull
CommentStatus
status
,
@NonNull
Integer
postId
)
{
Assert
.
notNull
(
postId
,
"Post id must not be null"
);
return
baseCommentRepository
.
countByStatusAndPostId
(
status
,
postId
);
}
@Override
public
long
countByStatus
(
@NonNull
CommentStatus
status
)
{
return
baseCommentRepository
.
countByStatus
(
status
);
...
...
src/main/java/run/halo/app/service/impl/JournalServiceImpl.java
浏览文件 @
44d740b7
...
...
@@ -107,10 +107,16 @@ public class JournalServiceImpl extends AbstractCrudService<Journal, Integer>
}
@Override
public
JournalDTO
convertTo
(
Journal
journal
)
{
public
Journal
WithCmtCount
DTO
convertTo
(
Journal
journal
)
{
Assert
.
notNull
(
journal
,
"Journal must not be null"
);
return
new
JournalDTO
().
convertFrom
(
journal
);
JournalWithCmtCountDTO
journalWithCmtCountDto
=
new
JournalWithCmtCountDTO
()
.
convertFrom
(
journal
);
journalWithCmtCountDto
.
setCommentCount
(
journalCommentService
.
countByStatusAndPostId
(
CommentStatus
.
PUBLISHED
,
journal
.
getId
()));
return
journalWithCmtCountDto
;
}
@Override
...
...
src/main/java/run/halo/app/service/impl/PostServiceImpl.java
浏览文件 @
44d740b7
...
...
@@ -787,7 +787,8 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
postDetailVO
.
setMetaIds
(
metaIds
);
postDetailVO
.
setMetas
(
postMetaService
.
convertTo
(
postMetaList
));
postDetailVO
.
setCommentCount
(
postCommentService
.
countByPostId
(
post
.
getId
()));
postDetailVO
.
setCommentCount
(
postCommentService
.
countByStatusAndPostId
(
CommentStatus
.
PUBLISHED
,
post
.
getId
()));
postDetailVO
.
setFullPath
(
buildFullPath
(
post
));
...
...
src/main/java/run/halo/app/service/impl/SheetServiceImpl.java
浏览文件 @
44d740b7
...
...
@@ -341,7 +341,8 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
sheetDetailVO
.
setSummary
(
generateSummary
(
sheet
.
getFormatContent
()));
}
sheetDetailVO
.
setCommentCount
(
sheetCommentService
.
countByPostId
(
sheet
.
getId
()));
sheetDetailVO
.
setCommentCount
(
sheetCommentService
.
countByStatusAndPostId
(
CommentStatus
.
PUBLISHED
,
sheet
.
getId
()));
sheetDetailVO
.
setFullPath
(
buildFullPath
(
sheet
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录