Files
CampusNotice/src/main/java/com/yunhai/campusnotice/entity/NoticeRead.java
T
wanghu 3016a97f1b
build / build-push (push) Failing after 1m18s
通知
2026-09-10 15:39:41 +08:00

72 lines
1.9 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.campusnotice.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.time.LocalDateTime;
/**
* 通知阅读记录(懒标记)。对应原 .NET Notify_ReceiveList 的「逐用户阅读状态」语义,
* 但仅在读者首次查看时落库,避免发通知时预插全员。
* <p>
* 唯一约束 (notice_id, reader_account):同一用户对同一通知只记一条已读。
*/
@NoArgsConstructor
@Data
@Entity
@Table(name = "notice_read",
uniqueConstraints = @UniqueConstraint(
name = "uk_notice_reader",
columnNames = {"notice_id", "reader_account"}))
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
public class NoticeRead extends BaseEntity {
/**
* 通知ID(关联 notice.id)
*/
@Column(name = "notice_id", nullable = false)
private Integer noticeId;
/**
* 读者登录账号
*/
@Column(name = "reader_account", nullable = false, length = 64)
private String readerAccount;
/**
* 读者姓名
*/
@Column(name = "reader_name", length = 64)
private String readerName;
/**
* 阅读时间
*/
@Column(name = "read_time")
private LocalDateTime readTime;
// ==================== 阅读身份快照(改造方案 2.3,学员阅读时带出) ====================
/** 学校ID(取通知 sch_id) */
@Column(name = "sch_id")
private Integer schId;
/** 年级ID快照 */
@Column(name = "grade_id")
private Integer gradeId;
/** 年级名称快照 */
@Column(name = "grade_name", length = 128)
private String gradeName;
/** 班级ID快照 */
@Column(name = "class_id")
private Integer classId;
/** 班级名称快照 */
@Column(name = "class_name", length = 128)
private String className;
}