File tree Expand file tree Collapse file tree
java/com/hackyle/blog/customer/module/article Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public class ArticleVo {
4949 */
5050 private Boolean commented ;
5151
52+ private String createTime ;
53+
5254 private String updateTime ;
5355
5456 /**
Original file line number Diff line number Diff line change @@ -90,9 +90,8 @@ public PageInfo<ArticleVo> list(ArticleQueryDto articleQueryDto) {
9090 for (ArticleEntity articleEntity : articleEntities ) {
9191 ArticleVo articleVo = BeanCopyUtils .copy (articleEntity , ArticleVo .class );
9292 articleVo .setUrl (articlePathPrefix + articleEntity .getPath ());
93-
94- LocalDateTime updateTime = articleEntity .getUpdateTime () == null ? articleEntity .getCreateTime () : articleEntity .getUpdateTime ();
95- articleVo .setUpdateTime (updateTime .format (DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" )));
93+ articleVo .setUpdateTime (articleEntity .getUpdateTime ().format (DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" )));
94+ articleVo .setCreateTime (articleEntity .getCreateTime ().format (DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" )));
9695
9796 List <CategoryDto > categoryDtos = articleCategoryMap .get (articleEntity .getId ());
9897 if (CollectionUtil .isNotEmpty (categoryDtos )) {
@@ -137,8 +136,8 @@ public ArticleVo get(String articleCode) {
137136
138137 ArticleVo articleVo = BeanCopyUtils .copy (articleEntity , ArticleVo .class );
139138 articleVo .setUrl (articlePathPrefix + articleEntity .getPath ());
140- LocalDateTime updateTime = articleEntity .getUpdateTime () == null ? articleEntity . getCreateTime () : articleEntity . getUpdateTime ( );
141- articleVo .setUpdateTime ( updateTime .format (DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" )));
139+ articleVo . setUpdateTime ( articleEntity .getUpdateTime (). format ( DateTimeFormatter . ofPattern ( "yyyy-MM-dd HH:mm:ss" )) );
140+ articleVo .setCreateTime ( articleEntity . getCreateTime () .format (DateTimeFormatter .ofPattern ("yyyy-MM-dd HH:mm:ss" )));
142141
143142 List <CategoryDto > categoryDtos = categoryService .getByArticleIds (Collections .singletonList (articleEntity .getId ()));
144143 if (CollectionUtil .isNotEmpty (categoryDtos )) {
Original file line number Diff line number Diff line change 7373 < h1 th:text ="${articleVo.title} "> title</ h1 >
7474
7575 < p >
76- < i th:if ="${articleVo.categoryNames != null} "> 文章分类:< span th:text ="${articleVo.categoryNames} "> </ span > ; </ i >
77- < i th:if ="${articleVo.authorNames != null} "> 作者:< span th:text ="${articleVo.authorNames} "> Hackyle</ span > ; </ i > < br />
76+ < i th:if ="${articleVo.categoryNames != null} "> 文章分类:< span th:text ="${articleVo.categoryNames} "> </ span >   </ i >
77+ < i th:if ="${articleVo.authorNames != null} "> 作者:< span th:text ="${articleVo.authorNames} "> Hackyle</ span > </ i > < br />
7878 </ p >
7979 < p >
80- < i th:if ="${articleVo.updateTime != null} "> 更新时间:< span th:text ="${articleVo.updateTime} "> </ span > </ i >
80+ < i th:if ="${articleVo.createTime != null} "> 创建时间:< span th:text ="${articleVo.createTime} "> </ span >  </ i >
81+ < i th:if ="${articleVo.updateTime != null} "> 最近一次更新时间:< span th:text ="${articleVo.updateTime} "> </ span > </ i >
8182 </ p >
8283
8384 <!--不显示的页面属性-->
You can’t perform that action at this time.
0 commit comments