From bf9c48b15a4cb70a898148836abc76e1bf19c887 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 7 Mar 2023 11:34:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/straw/dao/NoticeDao.java | 10 ++ .../com/xkrs/straw/dao/NoticeRelaDao.java | 10 ++ .../xkrs/straw/model/entity/NoticeEntity.java | 97 +++++++++++++++++++ .../straw/model/entity/NoticeRelaEntity.java | 82 ++++++++++++++++ 4 files changed, 199 insertions(+) create mode 100644 src/main/java/com/xkrs/straw/dao/NoticeDao.java create mode 100644 src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java create mode 100644 src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java create mode 100644 src/main/java/com/xkrs/straw/model/entity/NoticeRelaEntity.java diff --git a/src/main/java/com/xkrs/straw/dao/NoticeDao.java b/src/main/java/com/xkrs/straw/dao/NoticeDao.java new file mode 100644 index 0000000..9f22283 --- /dev/null +++ b/src/main/java/com/xkrs/straw/dao/NoticeDao.java @@ -0,0 +1,10 @@ +package com.xkrs.straw.dao; + +import com.xkrs.straw.model.entity.NoticeEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +@Component +public interface NoticeDao extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java b/src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java new file mode 100644 index 0000000..09d6394 --- /dev/null +++ b/src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java @@ -0,0 +1,10 @@ +package com.xkrs.straw.dao; + +import com.xkrs.straw.model.entity.NoticeRelaEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +@Component +public interface NoticeRelaDao extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java b/src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java new file mode 100644 index 0000000..c43e1df --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java @@ -0,0 +1,97 @@ +package com.xkrs.straw.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * 公告栏通知 + */ +@Entity +@Table(name = "notice") +public class NoticeEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "notice_seq_gen") + @SequenceGenerator(name = "notice_seq_gen", sequenceName = "notice_id_seq", allocationSize = 1) + private Long id; + + /** + * 标题 + */ + private String title; + + /** + * 内容 + */ + @Column(length = 40960, columnDefinition = "varchar(40960)") + private String content; + + /** + * 作者 + */ + private String author; + + /** + * 公告栏通知的状态 + * 0:正常 + * 1:禁用 + */ + private Integer state; + + public NoticeEntity() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + @Override + public String toString() { + return "NoticeEntity{" + + "id=" + id + + ", title='" + title + '\'' + + ", content='" + content + '\'' + + ", author='" + author + '\'' + + ", state=" + state + + '}'; + } +} diff --git a/src/main/java/com/xkrs/straw/model/entity/NoticeRelaEntity.java b/src/main/java/com/xkrs/straw/model/entity/NoticeRelaEntity.java new file mode 100644 index 0000000..ae02df5 --- /dev/null +++ b/src/main/java/com/xkrs/straw/model/entity/NoticeRelaEntity.java @@ -0,0 +1,82 @@ +package com.xkrs.straw.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * 公告栏通知关联表 + */ +@Entity +@Table(name = "notice_rela") +public class NoticeRelaEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "notice_rela_seq_gen") + @SequenceGenerator(name = "notice_rela_seq_gen", sequenceName = "notice_rela_id_seq", allocationSize = 1) + private Long id; + + /** + * 公告栏通知Id + */ + private Long noticeId; + + /** + * 用户Id + */ + private Long userId; + + /** + * 当前用户是否已读公告栏通知 + * 0:未读 + * 1:已读 + */ + private Integer state; + + public NoticeRelaEntity() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getNoticeId() { + return noticeId; + } + + public void setNoticeId(Long noticeId) { + this.noticeId = noticeId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + @Override + public String toString() { + return "NoticeRelaEntity{" + + "id=" + id + + ", noticeId=" + noticeId + + ", userId=" + userId + + ", state=" + state + + '}'; + } +}