Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
b2415d33
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,发现更多精彩内容 >>
提交
b2415d33
编写于
5月 05, 2019
作者:
RYAN0UP
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create ContentJournalController.java.
上级
2a503d85
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
108 addition
and
1 deletion
+108
-1
src/main/java/run/halo/app/controller/content/ContentJournalController.java
...halo/app/controller/content/ContentJournalController.java
+90
-0
src/main/java/run/halo/app/model/dto/EnvironmentDTO.java
src/main/java/run/halo/app/model/dto/EnvironmentDTO.java
+17
-0
src/main/java/run/halo/app/service/JournalService.java
src/main/java/run/halo/app/service/JournalService.java
+1
-1
未找到文件。
src/main/java/run/halo/app/controller/content/ContentJournalController.java
0 → 100644
浏览文件 @
b2415d33
package
run.halo.app.controller.content
;
import
cn.hutool.core.util.PageUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.web.SortDefault
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
run.halo.app.model.entity.Journal
;
import
run.halo.app.service.JournalCommentService
;
import
run.halo.app.service.JournalService
;
import
run.halo.app.service.OptionService
;
import
run.halo.app.service.ThemeService
;
import
static
org
.
springframework
.
data
.
domain
.
Sort
.
Direction
.
DESC
;
/**
* Blog journal page controller
*
* @author ryanwang
* @date : 2019-05-04
*/
@Slf4j
@Controller
@RequestMapping
(
value
=
"/journal"
)
public
class
ContentJournalController
{
private
final
JournalService
journalService
;
private
final
JournalCommentService
journalCommentService
;
private
final
OptionService
optionService
;
private
final
ThemeService
themeService
;
public
ContentJournalController
(
JournalService
journalService
,
JournalCommentService
journalCommentService
,
OptionService
optionService
,
ThemeService
themeService
)
{
this
.
journalService
=
journalService
;
this
.
journalCommentService
=
journalCommentService
;
this
.
optionService
=
optionService
;
this
.
themeService
=
themeService
;
}
/**
* Render journal page.
*
* @param model model
* @return template path: theme/{theme}/journal.ftl
*/
@GetMapping
public
String
journal
(
Model
model
)
{
return
this
.
journal
(
model
,
1
,
Sort
.
by
(
DESC
,
"createTime"
));
}
/**
* Render journal page.
*
* @param model model
* @param page current page number
* @return template path: theme/{theme}/journal.ftl
*/
@GetMapping
(
value
=
"page/{page}"
)
public
String
journal
(
Model
model
,
@PathVariable
(
value
=
"page"
)
Integer
page
,
@SortDefault
(
sort
=
"createTime"
,
direction
=
DESC
)
Sort
sort
)
{
log
.
debug
(
"Requested journal page, sort info: [{}]"
,
sort
);
int
pageSize
=
optionService
.
getPostPageSize
();
Pageable
pageable
=
PageRequest
.
of
(
page
>=
1
?
page
-
1
:
page
,
pageSize
,
sort
);
Page
<
Journal
>
journals
=
journalService
.
listAll
(
pageable
);
int
[]
rainbow
=
PageUtil
.
rainbow
(
page
,
journals
.
getTotalPages
(),
3
);
model
.
addAttribute
(
"is_journal"
,
true
);
model
.
addAttribute
(
"journals"
,
journals
);
model
.
addAttribute
(
"rainbow"
,
rainbow
);
return
themeService
.
render
(
"journal"
);
}
}
src/main/java/run/halo/app/model/dto/EnvironmentDTO.java
0 → 100644
浏览文件 @
b2415d33
package
run.halo.app.model.dto
;
import
lombok.Data
;
/**
* Theme controller.
*
* @author ryanwang
* @date : 2019/5/4
*/
@Data
public
class
EnvironmentDTO
{
private
String
database
;
private
long
startTime
;
}
src/main/java/run/halo/app/service/JournalService.java
浏览文件 @
b2415d33
...
...
@@ -44,7 +44,7 @@ public interface JournalService extends CrudService<Journal, Integer> {
*
* @param journalQuery journal query must not be null
* @param pageable page info must not be null
* @return a page of
post
* @return a page of
journal
*/
@NonNull
Page
<
Journal
>
pageBy
(
@NonNull
JournalQuery
journalQuery
,
@NonNull
Pageable
pageable
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录