diff --git a/backend/mci-server/src/main/java/com/sino/mci/channel/entity/ChannelEventRecord.java b/backend/mci-server/src/main/java/com/sino/mci/channel/entity/ChannelEventRecord.java new file mode 100644 index 0000000..7a05f2d --- /dev/null +++ b/backend/mci-server/src/main/java/com/sino/mci/channel/entity/ChannelEventRecord.java @@ -0,0 +1,22 @@ +package com.sino.mci.channel.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +@TableName("mci_channel_event_record") +public class ChannelEventRecord { + + @TableId(type = IdType.INPUT) + private String eventId; + + private String accountId; + + private String eventType; + + private LocalDateTime createTime; +} diff --git a/backend/mci-server/src/main/java/com/sino/mci/channel/repository/ChannelEventRecordMapper.java b/backend/mci-server/src/main/java/com/sino/mci/channel/repository/ChannelEventRecordMapper.java new file mode 100644 index 0000000..9cbd9b8 --- /dev/null +++ b/backend/mci-server/src/main/java/com/sino/mci/channel/repository/ChannelEventRecordMapper.java @@ -0,0 +1,9 @@ +package com.sino.mci.channel.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sino.mci.channel.entity.ChannelEventRecord; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ChannelEventRecordMapper extends BaseMapper { +} diff --git a/backend/mci-server/src/main/resources/db/migration/V22__add_channel_event_record.sql b/backend/mci-server/src/main/resources/db/migration/V22__add_channel_event_record.sql new file mode 100644 index 0000000..ff98f51 --- /dev/null +++ b/backend/mci-server/src/main/resources/db/migration/V22__add_channel_event_record.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS mci_channel_event_record ( + event_id VARCHAR(64) PRIMARY KEY, + account_id VARCHAR(64) NOT NULL, + event_type VARCHAR(32) NOT NULL, + create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_channel_event_account_time ON mci_channel_event_record(account_id, create_time);