优化
This commit is contained in:
parent
52bf40ac8c
commit
bf9c48b15a
10
src/main/java/com/xkrs/straw/dao/NoticeDao.java
Normal file
10
src/main/java/com/xkrs/straw/dao/NoticeDao.java
Normal 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> {
|
||||
}
|
10
src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java
Normal file
10
src/main/java/com/xkrs/straw/dao/NoticeRelaDao.java
Normal 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> {
|
||||
}
|
97
src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java
Normal file
97
src/main/java/com/xkrs/straw/model/entity/NoticeEntity.java
Normal 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user