SysMsgBean.java 5.14 KB
package com.glsx.dao.bean;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;


/**
 * id:当前字段是不是id字段(一个实体类中只能设置一个id字段)
 * columnName:表示当前属性在表中代表哪个字段
 * generatedId:设置属性值在数据表中的数据是否自增
 * useGetSet:是否使用Getter/Setter方法来访问这个字段
 * canBeNull:字段是否可以为空,默认值是true
 * unique:是否唯一
 * defaultValue:设置这个字段的默认值
 * foreignColumnName:外键约束指向的类中的属性名
 * foreign:当前字段是否是外键
 * foreignAutoRefresh:如果这个属性设置为true,在关联查询的时候就不需要再调用refresh()方法了
 */
// 数据库表名,默认为类名
@DatabaseTable (tableName = SysMsgBean.TABLE_NAME)
public class SysMsgBean {
    //为了沿用之前数据库的数据,表名和列名和之前保持一致.以防数据读取异常2021年6月23日
    public static final String TABLE_NAME               = "SYS_MSG_BEAN";
    public static final String COLUMN_NAME_ID           = "_id";
    public static final String COLUMN_NAME_MSG_TYPE     = "MSG_TYPE";
    public static final String COLUMN_NAME_MSG_STATE    = "MSG_STATE";
    public static final String COLUMN_NAME_MSG_TIME     = "MSG_TIME";
    public static final String COLUMN_NAME_MSG_CONTENT  = "MSG_CONTENT";
    public static final String COLUMN_NAME_MSG_URL      = "MSG_URL";
    public static final String COLUMN_NAME_DEVICE_SN    = "DEVICE_SN";
    public static final String COLUMN_NAME_USER_ID      = "USER_ID";
    public static final String COLUMN_NAME_POSITION     = "POSITION";
    // 主键
    @DatabaseField(columnName = COLUMN_NAME_ID,generatedId = true,dataType = DataType.INTEGER)
    public int id;
    @DatabaseField(columnName = COLUMN_NAME_MSG_TYPE,dataType = DataType.INTEGER)
    public int msgType; //消息类型 实时照片拍摄成功消息、回看视频下载成功消息
    @DatabaseField(columnName = COLUMN_NAME_MSG_STATE,dataType = DataType.INTEGER)
    public int msgState; //消息状态
    @DatabaseField(columnName = COLUMN_NAME_MSG_TIME,dataType = DataType.STRING)
    public String msgTime; //消息时间
    @DatabaseField(columnName = COLUMN_NAME_MSG_CONTENT,dataType = DataType.STRING)
    public String msgContent; //消息内容
    @DatabaseField(columnName = COLUMN_NAME_MSG_URL,dataType = DataType.STRING)
    public String msgUrl; // 视频\照片详情
    @DatabaseField(columnName = COLUMN_NAME_DEVICE_SN,dataType = DataType.STRING)
    public String deviceSn; //
    @DatabaseField(columnName = COLUMN_NAME_USER_ID,dataType = DataType.STRING)
    public String userId; //
    @DatabaseField(columnName = COLUMN_NAME_POSITION,dataType = DataType.STRING)
    public String position;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getMsgType() {
        return msgType;
    }

    public void setMsgType(int msgType) {
        this.msgType = msgType;
    }

    public int getMsgState() {
        return msgState;
    }

    public void setMsgState(int msgState) {
        this.msgState = msgState;
    }

    public String getMsgTime() {
        return msgTime;
    }

    public void setMsgTime(String msgTime) {
        this.msgTime = msgTime;
    }

    public String getMsgContent() {
        return msgContent;
    }

    public void setMsgContent(String msgContent) {
        this.msgContent = msgContent;
    }

    public String getMsgUrl() {
        return msgUrl;
    }

    public void setMsgUrl(String msgUrl) {
        this.msgUrl = msgUrl;
    }

    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public SysMsgBean() {
    }

    public SysMsgBean(int id, Integer msgType, Integer msgState, String msgTime,
                      String msgContent, String msgUrl, String deviceSn, String userId,
                      String position) {
        this.id = id;
        this.msgType = msgType;
        this.msgState = msgState;
        this.msgTime = msgTime;
        this.msgContent = msgContent;
        this.msgUrl = msgUrl;
        this.deviceSn = deviceSn;
        this.userId = userId;
        this.position = position;
    }

    @Override
    public String toString() {
        return "SysMsgBean{" +
                "id=" + id +
                ", msgType=" + msgType +
                ", msgState=" + msgState +
                ", msgTime='" + msgTime + '\'' +
                ", msgContent='" + msgContent + '\'' +
                ", msgUrl='" + msgUrl + '\'' +
                ", deviceSn='" + deviceSn + '\'' +
                ", userId='" + userId + '\'' +
                ", position='" + position + '\'' +
                '}';
    }
}