✨ 文章延续阅读功能
This commit is contained in:
parent
89b6747d5d
commit
9ce6616fd3
@ -2,6 +2,8 @@ package com.rymcu.vertical.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@ -20,4 +22,6 @@ public class PortfolioArticleDTO {
|
||||
|
||||
private Integer sortNo;
|
||||
|
||||
private List<ArticleDTO> articles;
|
||||
|
||||
}
|
||||
|
@ -168,4 +168,12 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleLinkAndPreviewContent(@Param("idArticle") Integer idArticle, @Param("articleLink") String articleLink, @Param("articlePermalink") String articlePermalink, @Param("articlePreviewContent") String articlePreviewContent);
|
||||
|
||||
/**
|
||||
* 根据专题主键及当前文章排序号获取专题下文章大纲
|
||||
* @param idPortfolio
|
||||
* @param sortNo
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectPortfolioArticlesByIdPortfolioAndSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("sortNo") Integer sortNo);
|
||||
}
|
||||
|
@ -350,6 +350,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
article.setArticleContent(articleContent.getArticleContentHtml());
|
||||
// 获取所属作品集列表数据
|
||||
List<PortfolioArticleDTO> portfolioArticleDTOList = articleMapper.selectPortfolioArticles(article.getIdArticle());
|
||||
portfolioArticleDTOList.forEach(portfolioArticleDTO -> genPortfolioArticles(portfolioArticleDTO));
|
||||
article.setPortfolios(portfolioArticleDTOList);
|
||||
} else if (type.equals(ARTICLE_EDIT)) {
|
||||
article.setArticleContent(articleContent.getArticleContent());
|
||||
@ -360,6 +361,12 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
return article;
|
||||
}
|
||||
|
||||
private PortfolioArticleDTO genPortfolioArticles(PortfolioArticleDTO portfolioArticleDTO) {
|
||||
List<ArticleDTO> articles = articleMapper.selectPortfolioArticlesByIdPortfolioAndSortNo(portfolioArticleDTO.getIdPortfolio(), portfolioArticleDTO.getSortNo());
|
||||
portfolioArticleDTO.setArticles(articles);
|
||||
return portfolioArticleDTO;
|
||||
}
|
||||
|
||||
private Author genAuthor(ArticleDTO article) {
|
||||
Author author = new Author();
|
||||
author.setUserNickname(article.getArticleAuthorName());
|
||||
|
@ -60,6 +60,7 @@
|
||||
<result column="id_vertical_article" property="idArticle"></result>
|
||||
<result column="portfolio_title" property="portfolioTitle"></result>
|
||||
<result column="portfolio_head_img_url" property="headImgUrl"></result>
|
||||
<result column="sort_no" property="sortNo"></result>
|
||||
</resultMap>
|
||||
<insert id="insertArticleContent">
|
||||
insert into vertical_article_content (id_article,article_content,article_content_html,created_time,updated_time)
|
||||
@ -131,9 +132,12 @@
|
||||
and instr(art.article_title, #{searchText}) > 0 and art.id not in (select id_vertical_article from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}) order by updated_time desc
|
||||
</select>
|
||||
<select id="selectPortfolioArticles" resultMap="PortfolioArticleResultMap">
|
||||
select vp.portfolio_title,vp.portfolio_head_img_url,vpa.id_vertical_portfolio,vpa.id_vertical_article from vertical_portfolio vp join vertical_portfolio_article vpa on vp.id = vpa.id_vertical_portfolio where vpa.id_vertical_article = #{idArticle}
|
||||
select vp.portfolio_title,vp.portfolio_head_img_url,vpa.id_vertical_portfolio,vpa.id_vertical_article,vpa.sort_no from vertical_portfolio vp join vertical_portfolio_article vpa on vp.id = vpa.id_vertical_portfolio where vpa.id_vertical_article = #{idArticle}
|
||||
</select>
|
||||
<select id="existsCommentWithPrimaryKey" resultType="java.lang.Boolean">
|
||||
select exists (select * from vertical_comment where comment_article_id = #{id})
|
||||
</select>
|
||||
<select id="selectPortfolioArticlesByIdPortfolioAndSortNo" resultMap="DTOResultMap">
|
||||
select va.article_title, va.id, va.article_permalink from vertical_portfolio_article vpa join vertical_article va on va.id = vpa.id_vertical_article where id_vertical_portfolio = #{idPortfolio} and sort_no > (#{sortNo} - 2) order by sort_no limit 20
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user