🎨 专题页代码结构完善
This commit is contained in:
parent
4736f383ce
commit
33d7856bd5
@ -26,10 +26,10 @@ public interface ArticleService extends Service<Article> {
|
|||||||
/**
|
/**
|
||||||
* 查询文章详情信息
|
* 查询文章详情信息
|
||||||
* @param id
|
* @param id
|
||||||
* @param i
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
ArticleDTO findArticleDTOById(Integer id, int i);
|
ArticleDTO findArticleDTOById(Integer id, Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询主题下文章列表
|
* 查询主题下文章列表
|
||||||
|
@ -66,7 +66,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArticleDTO findArticleDTOById(Integer id, int type) {
|
public ArticleDTO findArticleDTOById(Integer id, Integer type) {
|
||||||
ArticleDTO articleDTO = articleMapper.selectArticleDTOById(id,type);
|
ArticleDTO articleDTO = articleMapper.selectArticleDTOById(id,type);
|
||||||
if (articleDTO == null) {
|
if (articleDTO == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -78,6 +78,9 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
@Override
|
@Override
|
||||||
public List<ArticleDTO> findArticlesByTopicUri(String name) {
|
public List<ArticleDTO> findArticlesByTopicUri(String name) {
|
||||||
List<ArticleDTO> articleDTOS = articleMapper.selectArticlesByTopicUri(name);
|
List<ArticleDTO> articleDTOS = articleMapper.selectArticlesByTopicUri(name);
|
||||||
|
articleDTOS.forEach(articleDTO -> {
|
||||||
|
genArticle(articleDTO,0);
|
||||||
|
});
|
||||||
return articleDTOS;
|
return articleDTOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,16 +269,14 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
article.setTimeAgo(Utils.getTimeAgo(article.getUpdatedTime()));
|
article.setTimeAgo(Utils.getTimeAgo(article.getUpdatedTime()));
|
||||||
List<ArticleTagDTO> tags = articleMapper.selectTags(article.getIdArticle());
|
List<ArticleTagDTO> tags = articleMapper.selectTags(article.getIdArticle());
|
||||||
article.setTags(tags);
|
article.setTags(tags);
|
||||||
if(type == 1){
|
|
||||||
ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle());
|
ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle());
|
||||||
|
if (type == 1){
|
||||||
article.setArticleContent(articleContent.getArticleContentHtml());
|
article.setArticleContent(articleContent.getArticleContentHtml());
|
||||||
} else if(type == 2){
|
} else if (type == 2) {
|
||||||
ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle());
|
|
||||||
article.setArticleContent(articleContent.getArticleContent());
|
article.setArticleContent(articleContent.getArticleContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isBlank(article.getArticlePreviewContent())){
|
if(StringUtils.isBlank(article.getArticlePreviewContent())){
|
||||||
ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle());
|
|
||||||
Integer length = articleContent.getArticleContentHtml().length();
|
Integer length = articleContent.getArticleContentHtml().length();
|
||||||
if(length > MAX_PREVIEW){
|
if(length > MAX_PREVIEW){
|
||||||
length = 200;
|
length = 200;
|
||||||
|
Loading…
Reference in New Issue
Block a user