Skip to content

Commit

Permalink
Merge pull request #145 from YoungYo/master
Browse files Browse the repository at this point in the history
发布文章时,支持自定义摘要;markdown支持多行公式
  • Loading branch information
linhaojun857 committed Aug 29, 2023
2 parents b7b73d8 + 36f7a5f commit f1ba975
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 10 deletions.
1 change: 1 addition & 0 deletions aurora-springboot/sql/aurora.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CREATE TABLE `t_article` (
`category_id` int NULL DEFAULT NULL COMMENT '文章分类',
`article_cover` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文章缩略图',
`article_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '标题',
`article_abstract` varchar(500) DEFAULT NULL COMMENT '文章摘要,如果该字段为空,默认取文章的前500个字符作为摘要',
`article_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '内容',
`is_top` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否置顶 0否 1是',
`is_featured` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否推荐 0否 1是',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class Article {

private String articleTitle;

private String articleAbstract;

private String articleContent;

private Integer isTop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class ArticleAdminViewDTO {

private String articleTitle;

private String articleAbstract;

private String articleContent;

private String articleCover;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class ArticleVO {
@ApiModelProperty(name = "articleContent", value = "文章内容", required = true, dataType = "String")
private String articleContent;

@ApiModelProperty(name = "articleAbstract", value = "文章摘要", dataType = "String")
private String articleAbstract;

@ApiModelProperty(name = "articleCover", value = "文章缩略图", dataType = "String")
private String articleCover;

Expand Down
26 changes: 17 additions & 9 deletions aurora-springboot/src/main/resources/mapper/ArticleMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
category_id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -79,6 +79,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -100,7 +101,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -115,6 +116,7 @@
user_id,
category_id,
article_cover,
article_abstract,
article_title,
article_content,
is_top,
Expand All @@ -138,7 +140,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -154,6 +156,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand Down Expand Up @@ -194,6 +197,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -217,7 +221,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -233,6 +237,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -256,7 +261,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -272,6 +277,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -295,7 +301,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -311,6 +317,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -333,7 +340,7 @@
SELECT a.id AS id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -349,6 +356,7 @@
category_id,
article_cover,
article_title,
article_abstract,
article_content,
is_top,
is_featured,
Expand All @@ -372,7 +380,7 @@
category_id,
article_cover,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
is_top,
is_featured,
status,
Expand All @@ -397,7 +405,7 @@
<select id="listArchives" resultType="com.aurora.model.dto.ArticleCardDTO">
SELECT id,
article_title,
SUBSTR(article_content, 1, 500) AS article_content,
if(article_abstract is null or article_abstract = '', SUBSTR(article_content, 1, 500), article_abstract) AS article_content,
create_time
FROM t_article
WHERE is_delete = 0
Expand Down
Loading

0 comments on commit f1ba975

Please sign in to comment.