package com.lxyer.redim.entity;

import org.redkale.convert.json.JsonConvert;

import javax.persistence.*;

/**
 *
 * @author lxyer
 */
@Cacheable(interval = 5*60)
@Table(catalog = "redbbs", name = "im_msgrecord", comment = "[聊天记录表]")
public class MsgRecord implements java.io.Serializable {

    @Id
    @GeneratedValue
    @Column(comment = "[主键id]")
    private int msgid;

    @Column(comment = "[发送人]")
    private int fromuserid;

    @Column(comment = "[接收人]")
    private int touserid;

    @Column(comment = "[内容]")
    private String content = "";

    @Column(updatable = false, comment = "[发送时间]")
    private long createtime = System.currentTimeMillis();

    @Column(comment = "[状态]-10删除，10未发送 20已发送 30已读")
    private short status = 10;

    public void setMsgid(int msgid) {
        this.msgid = msgid;
    }

    public int getMsgid() {
        return this.msgid;
    }

    public void setFromuserid(int fromuserid) {
        this.fromuserid = fromuserid;
    }

    public int getFromuserid() {
        return this.fromuserid;
    }

    public void setTouserid(int touserid) {
        this.touserid = touserid;
    }

    public int getTouserid() {
        return this.touserid;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setCreatetime(long createtime) {
        this.createtime = createtime;
    }

    public long getCreatetime() {
        return this.createtime;
    }

    public void setStatus(short status) {
        this.status = status;
    }

    public short getStatus() {
        return this.status;
    }

    @Override
    public String toString() {
        return JsonConvert.root().convertTo(this);
    }
}
