富文本保存时,保存纯文本contentText

This commit is contained in:
34701892@qq.com 2024-12-15 11:05:25 +08:00
parent 4ed4cbd708
commit aa7a87822a
3 changed files with 24 additions and 2 deletions

View File

@ -43,6 +43,7 @@ public interface NewsMapper {
"summary = #{summary}," + "summary = #{summary}," +
"picture = #{picture}," + "picture = #{picture}," +
"content = #{content}," + "content = #{content}," +
"content_text = #{contentText}," +
"status = #{status}," + "status = #{status}," +
"update_time = now() " + "update_time = now() " +
"where id = #{id}") "where id = #{id}")
@ -55,6 +56,7 @@ public interface NewsMapper {
"summary = #{summary}," + "summary = #{summary}," +
"picture = #{picture}," + "picture = #{picture}," +
"content = #{content}," + "content = #{content}," +
"content_text = #{contentText}," +
"status = #{status}," + "status = #{status}," +
"update_time = now()," + "update_time = now()," +
"publish_time = now() " + "publish_time = now() " +
@ -71,8 +73,8 @@ public interface NewsMapper {
"values (#{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())") "values (#{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())")
void saveDraft(NewsDraft newsDraft); void saveDraft(NewsDraft newsDraft);
@Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status, publish_time)" + @Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status, publish_time, content_text)" +
"values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status}, #{publishTime})") "values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status}, #{publishTime}, #{contentText})")
void saveNews(News news); void saveNews(News news);

View File

@ -20,6 +20,8 @@ public class SaveNewsDTO {
private SaveDraftColumn column; private SaveDraftColumn column;
private String content; private String content;
// 不含html标签的纯文本
private String contentText;
private Integer status; private Integer status;
private Date publishTime; private Date publishTime;
@ -106,4 +108,12 @@ public class SaveNewsDTO {
public void setPublishTime(Date publishTime) { public void setPublishTime(Date publishTime) {
this.publishTime = publishTime; this.publishTime = publishTime;
} }
public String getContentText() {
return contentText;
}
public void setContentText(String contentText) {
this.contentText = contentText;
}
} }

View File

@ -49,6 +49,7 @@ public class News {
* H5富文本 * H5富文本
*/ */
private String content; private String content;
private String contentText;
/** /**
* 新闻状态 0-草稿 | 1-未发布 | 2-已发布 * 新闻状态 0-草稿 | 1-未发布 | 2-已发布
@ -80,6 +81,7 @@ public class News {
this.type = 1; this.type = 1;
this.status = saveNewsDTO.getStatus(); this.status = saveNewsDTO.getStatus();
this.content = saveNewsDTO.getContent(); this.content = saveNewsDTO.getContent();
this.contentText = saveNewsDTO.getContentText();
this.publishTime = saveNewsDTO.getPublishTime(); this.publishTime = saveNewsDTO.getPublishTime();
// this.status = 0; // this.status = 0;
this.createTime = new Date(); this.createTime = new Date();
@ -181,4 +183,12 @@ public class News {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getContentText() {
return contentText;
}
public void setContentText(String contentText) {
this.contentText = contentText;
}
} }