This commit is contained in:
liuchengqian 2023-03-07 11:34:19 +08:00
parent 52bf40ac8c
commit bf9c48b15a
4 changed files with 199 additions and 0 deletions

View File

@ -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<NoticeEntity, Long>, JpaSpecificationExecutor<NoticeEntity> {
}

View File

@ -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<NoticeRelaEntity, Long>, JpaSpecificationExecutor<NoticeRelaEntity> {
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}