89 行
2.8 KiB
Java
89 行
2.8 KiB
Java
|
|
package com.xuqm.im.entity;
|
||
|
|
|
||
|
|
import jakarta.persistence.Column;
|
||
|
|
import jakarta.persistence.Entity;
|
||
|
|
import jakarta.persistence.EnumType;
|
||
|
|
import jakarta.persistence.Enumerated;
|
||
|
|
import jakarta.persistence.Id;
|
||
|
|
import jakarta.persistence.Index;
|
||
|
|
import jakarta.persistence.Table;
|
||
|
|
import java.time.LocalDateTime;
|
||
|
|
|
||
|
|
@Entity
|
||
|
|
@Table(name = "im_message", indexes = {
|
||
|
|
@Index(name = "idx_app_from", columnList = "appId,fromUserId"),
|
||
|
|
@Index(name = "idx_app_to", columnList = "appId,toId")
|
||
|
|
})
|
||
|
|
public class ImMessageEntity {
|
||
|
|
|
||
|
|
public enum ChatType { SINGLE, GROUP }
|
||
|
|
public enum MsgType {
|
||
|
|
TEXT, IMAGE, VIDEO, AUDIO, FILE, CUSTOM, LOCATION, NOTIFY,
|
||
|
|
RICH_TEXT, CALL_AUDIO, CALL_VIDEO, REVOKED, FORWARD
|
||
|
|
}
|
||
|
|
public enum MsgStatus { SENT, DELIVERED, READ, REVOKED }
|
||
|
|
|
||
|
|
@Id
|
||
|
|
private String id;
|
||
|
|
|
||
|
|
@Column(nullable = false, length = 64)
|
||
|
|
private String appId;
|
||
|
|
|
||
|
|
@Column(nullable = false, length = 128)
|
||
|
|
private String fromUserId;
|
||
|
|
|
||
|
|
@Column(nullable = false, length = 128)
|
||
|
|
private String toId;
|
||
|
|
|
||
|
|
@Enumerated(EnumType.STRING)
|
||
|
|
@Column(nullable = false, length = 16)
|
||
|
|
private ChatType chatType;
|
||
|
|
|
||
|
|
@Enumerated(EnumType.STRING)
|
||
|
|
@Column(nullable = false, length = 16)
|
||
|
|
private MsgType msgType;
|
||
|
|
|
||
|
|
@Column(nullable = false, columnDefinition = "TEXT")
|
||
|
|
private String content;
|
||
|
|
|
||
|
|
@Enumerated(EnumType.STRING)
|
||
|
|
@Column(nullable = false, length = 16)
|
||
|
|
private MsgStatus status;
|
||
|
|
|
||
|
|
@Column(length = 128)
|
||
|
|
private String mentionedUserIds;
|
||
|
|
|
||
|
|
@Column(nullable = false)
|
||
|
|
private LocalDateTime createdAt;
|
||
|
|
|
||
|
|
public String getId() { return id; }
|
||
|
|
public void setId(String id) { this.id = id; }
|
||
|
|
|
||
|
|
public String getAppId() { return appId; }
|
||
|
|
public void setAppId(String appId) { this.appId = appId; }
|
||
|
|
|
||
|
|
public String getFromUserId() { return fromUserId; }
|
||
|
|
public void setFromUserId(String fromUserId) { this.fromUserId = fromUserId; }
|
||
|
|
|
||
|
|
public String getToId() { return toId; }
|
||
|
|
public void setToId(String toId) { this.toId = toId; }
|
||
|
|
|
||
|
|
public ChatType getChatType() { return chatType; }
|
||
|
|
public void setChatType(ChatType chatType) { this.chatType = chatType; }
|
||
|
|
|
||
|
|
public MsgType getMsgType() { return msgType; }
|
||
|
|
public void setMsgType(MsgType msgType) { this.msgType = msgType; }
|
||
|
|
|
||
|
|
public String getContent() { return content; }
|
||
|
|
public void setContent(String content) { this.content = content; }
|
||
|
|
|
||
|
|
public MsgStatus getStatus() { return status; }
|
||
|
|
public void setStatus(MsgStatus status) { this.status = status; }
|
||
|
|
|
||
|
|
public String getMentionedUserIds() { return mentionedUserIds; }
|
||
|
|
public void setMentionedUserIds(String mentionedUserIds) { this.mentionedUserIds = mentionedUserIds; }
|
||
|
|
|
||
|
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||
|
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||
|
|
}
|