package com.vverp.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.vverp.annotation.Module; import javax.persistence.*; /** * 消息通知实例 * * @author dealsky * @date 2020/1/15 10:09 上午 */ @Entity @Table(name = "t_notice_entity") @SequenceGenerator(name = "sequenceGenerator", sequenceName = "seq_notice_entity") @Module(generate = false) public class NoticeEntity extends BaseEntity { /** * 通知 */ private Notice notice; /** * 员工 */ private Admin admin; /** * 是否已读 */ private Boolean read; private String content; private String title; public String getTitle() { if(getNotice() != null){ return getNotice().getTitle(); }else { return title; } } public void setTitle(String title) { this.title = title; } public String getContent() { if(getNotice() != null){ return getNotice().getContent(); }else { return content; } } public void setContent(String content) { this.content = content; } @JsonIgnore @ManyToOne(fetch = FetchType.LAZY) public Notice getNotice() { return notice; } public void setNotice(Notice notice) { this.notice = notice; } @JsonIgnore @ManyToOne(fetch = FetchType.LAZY) public Admin getAdmin() { return admin; } public void setAdmin(Admin admin) { this.admin = admin; } @Column(name = "is_read", nullable = false) public Boolean getRead() { return read; } public void setRead(Boolean read) { this.read = read; } }