| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- package com.uas.service.donate.model;
- import com.alibaba.fastjson.annotation.JSONField;
- import com.fasterxml.jackson.annotation.JsonIgnore;
- import org.hibernate.validator.constraints.Length;
- import javax.persistence.*;
- import java.io.Serializable;
- import java.util.Date;
- import java.util.Set;
- /**
- * 消息通知表
- *
- */
- @Entity
- @Table(name = "donate$message")
- public class Message implements Serializable {
- /**
- * 序号
- */
- private static final long serialVersionUID = 1L;
- /**
- * id
- */
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "dm_id")
- private Long id;
- /**
- * 发布用户UU
- */
- @Column(name = "dm_useruu")
- private Long userUU;
- /**
- * 发布用户
- */
- @OneToOne(cascade = CascadeType.REFRESH)
- @JoinColumn(name = "dm_useruu", insertable = false, updatable = false)
- private User user;
- /**
- * 提交时间
- */
- @Column(name = "dm_date")
- private Date date;
- /**
- * 发布时间
- */
- @Column(name = "dm_publishdate")
- private Date publishDate;
- /**
- * 消息标题
- */
- @Column(name = "dm_title")
- private String title;
- /**
- * 消息正文
- */
- @Column(name = "dm_context")
- @Length(max = 600)
- private String context;
- /**
- * 消息类型(角色类型、机构对象、指定用户、所有用户)
- */
- @Column(name = "dm_type")
- private String type;
- /**
- * 来源表
- */
- @Column(name = "dm_table")
- private String table;
- /**
- * 来源id
- */
- @Column(name = "dm_sourceid")
- private Long sourceId;
- /**
- * 单据链接
- */
- @Column(name = "dm_url")
- private String url;
- /**
- * 消息明细
- */
- @OneToMany(mappedBy = "message", cascade = CascadeType.REFRESH)
- @OrderBy("dmd_id DESC")
- private Set<MessageDetail> messageDetails;
- /**
- * 接收对象
- */
- @Column(name = "dm_receiver")
- private String receiver;
- /**
- * 阅读人数
- */
- @Column(name = "dm_readernum")
- private Integer readerNum;
- /**
- * 消息接收人数
- */
- @Column(name = "dm_receivernum")
- private Integer receiverNum;
- public Message() {
- }
- public Message(Long userUU, String title, String context, String type, String table, Long sourceId, String url, String receiver) {
- this.userUU = userUU;
- this.title = title;
- this.context = context;
- this.type = type;
- this.table = table;
- this.sourceId = sourceId;
- this.url = url;
- this.receiver = receiver;
- this.date = new Date();
- this.publishDate = new Date();
- this.readerNum = 0;
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public Long getUserUU() {
- return userUU;
- }
- public void setUserUU(Long userUU) {
- this.userUU = userUU;
- }
- public User getUser() {
- return user;
- }
- public void setUser(User user) {
- this.user = user;
- }
- public Date getDate() {
- return date;
- }
- public void setDate(Date date) {
- this.date = date;
- }
- public Date getPublishDate() {
- return publishDate;
- }
- public void setPublishDate(Date publishDate) {
- this.publishDate = publishDate;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getContext() {
- return context;
- }
- public void setContext(String context) {
- this.context = context;
- }
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- public String getTable() {
- return table;
- }
- public void setTable(String table) {
- this.table = table;
- }
- public Long getSourceId() {
- return sourceId;
- }
- public void setSourceId(Long sourceId) {
- this.sourceId = sourceId;
- }
- public String getUrl() {
- return url;
- }
- public void setUrl(String url) {
- this.url = url;
- }
- @JsonIgnore
- @JSONField(serialize = false)
- public Set<MessageDetail> getMessageDetails() {
- return messageDetails;
- }
- public void setMessageDetails(Set<MessageDetail> messageDetails) {
- this.messageDetails = messageDetails;
- }
- public String getReceiver() {
- return receiver;
- }
- public void setReceiver(String receiver) {
- this.receiver = receiver;
- }
- public Integer getReaderNum() {
- return readerNum;
- }
- public void setReaderNum(Integer readerNum) {
- this.readerNum = readerNum;
- }
- public Integer getReceiverNum() {
- return this.receiverNum;
- }
- public void setReceiverNum(Integer receiverNum) {
- this.receiverNum = receiverNum;
- }
- }
|