92 lines
1.9 KiB
Java
92 lines
1.9 KiB
Java
package com.example.entity;
|
|
|
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
import com.baomidou.mybatisplus.annotation.TableId;
|
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import lombok.Data;
|
|
|
|
import java.util.Date;
|
|
|
|
/**
|
|
* 聊天消息实体类
|
|
*/
|
|
@Data
|
|
@TableName("chat_message")
|
|
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性
|
|
public class ChatMessage {
|
|
|
|
/**
|
|
* 消息ID
|
|
*/
|
|
@TableId(type = IdType.AUTO)
|
|
private Integer id;
|
|
|
|
/**
|
|
* 发送者ID
|
|
*/
|
|
private Integer senderId;
|
|
|
|
/**
|
|
* 接收者ID
|
|
*/
|
|
private Integer receiverId;
|
|
|
|
/**
|
|
* 发送者类型(doctor/patient)
|
|
*/
|
|
private String senderType;
|
|
|
|
/**
|
|
* 接收者类型(doctor/patient)
|
|
*/
|
|
private String receiverType;
|
|
|
|
/**
|
|
* 消息内容
|
|
*/
|
|
private String content;
|
|
|
|
/**
|
|
* 发送时间
|
|
*/
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
private Date sendTime;
|
|
|
|
/**
|
|
* 是否已读(0-未读,1-已读)
|
|
*/
|
|
private Boolean isRead;
|
|
|
|
/**
|
|
* 阅读时间
|
|
*/
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
private Date readTime;
|
|
|
|
/**
|
|
* 发送者名称(非数据库字段)
|
|
*/
|
|
@TableField(exist = false)
|
|
private String senderName;
|
|
|
|
/**
|
|
* 接收者名称(非数据库字段)
|
|
*/
|
|
@TableField(exist = false)
|
|
private String receiverName;
|
|
|
|
/**
|
|
* 发送者头像(非数据库字段)
|
|
*/
|
|
@TableField(exist = false)
|
|
private String senderAvatar;
|
|
|
|
/**
|
|
* 临时消息ID(用于前端标识临时消息,非数据库字段)
|
|
*/
|
|
@TableField(exist = false)
|
|
private String tempId;
|
|
} |