feat(db): add channel event record idempotency table

This commit is contained in:
2026-07-10 12:20:35 +08:00
parent 4b0780c181
commit e3bae8aa1f
3 changed files with 39 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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<ChannelEventRecord> {
}

View File

@@ -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);