Files
YschcmsService/src/main/java/com/yunhai/cms/entity/CmsArticle.java
T
2026-09-07 09:09:39 +08:00

85 lines
2.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.yunhai.cms.entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.time.LocalDateTime;
/**
* CMS 文章(方案 §5.1 表3)。
* 审核状态机为演进项(触发后加 audit_status 列);ext_json 保留键:
* {@code wechat}(推送回执,本期不写)、{@code albums}(图集演进)。
*/
@Getter
@Setter
@Entity
@Table(name = "cms_article", indexes = {
@Index(name = "idx_art_list", columnList = "site_id, category_id, status, publish_time"),
@Index(name = "idx_art_site_top", columnList = "site_id, status, topmost")})
public class CmsArticle extends BaseEntity {
/** 所属站点(隔离/查询维度;文章不冗余 sch_id,权限经 site 一跳映射) */
@Column(name = "site_id", nullable = false)
private Integer siteId;
/** 所属栏目(逻辑外键 → cms_category.id) */
@Column(name = "category_id", nullable = false)
private Integer categoryId;
/** 标题 */
@Column(name = "title", nullable = false, length = 200)
private String title;
/** 摘要(列表/SEO 用,空=截取正文) */
@Column(name = "summary", length = 500)
private String summary;
/** 正文 HTML(wangEditor 产出,保存时 jsoup 白名单清洗,方案 §8.5) */
@Column(name = "content", columnDefinition = "LONGTEXT")
private String content;
/** 封面图 URL */
@Column(name = "cover_image", length = 500)
private String coverImage;
/** 作者账号(发布时从 BoaUser 填充) */
@Column(name = "author_account", length = 64)
private String authorAccount;
/** 作者姓名(冗余展示) */
@Column(name = "author_name", length = 64)
private String authorName;
/** 来源(转载出处) */
@Column(name = "source", length = 128)
private String source;
/** 状态:0=草稿 1=已发布 2=已下架(见 ArticleStatusEnum) */
@Column(name = "status", nullable = false)
private Integer status = 0;
/** 置顶:0/1 */
@Column(name = "topmost", nullable = false)
private Integer topmost = 0;
/** 发布时间(空=保存即发布;未来=定时发布) */
@Column(name = "publish_time")
private LocalDateTime publishTime;
/** 下架时间(可选,@Scheduled 每分钟扫描到期记录) */
@Column(name = "offline_time")
private LocalDateTime offlineTime;
/** 浏览量(MVP 异步累加,量大后改缓存聚合) */
@Column(name = "view_count", nullable = false)
private Integer viewCount = 0;
/** 扩展字段 JSON(wechat/albums 预留,免 DDL 演进) */
@Column(name = "ext_json", columnDefinition = "JSON")
private String extJson;
}