送礼记录-雪花主键-无锁化唯一主键插入

This commit is contained in:
2025-09-23 17:10:35 +08:00
committed by 杨志恒
parent abb0b2e9f3
commit 1ece3f668f
10 changed files with 206 additions and 10 deletions

View File

@@ -8,7 +8,7 @@ import java.util.Date;
@Data
public class GiftSendRecord {
@TableId(type = IdType.AUTO)
@TableId(type = IdType.INPUT)
private Long sendRecordId;
private Long uid;

View File

@@ -2,7 +2,8 @@ package com.accompany.sharding.mapper;
import com.accompany.sharding.model.GiftSendRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface GiftSendRecordMapper extends BaseMapper<GiftSendRecord> {
}
int insertIgnore(@Param("record") GiftSendRecord record);
}

View File

@@ -1,5 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.accompany.sharding.mapper.GiftSendRecordMapper">
</mapper>
<insert id="insertIgnore" parameterType="com.accompany.sharding.model.GiftSendRecord">
INSERT IGNORE INTO gift_send_record (
send_record_id,
uid,
partition_id,
recive_uid,
recive_type,
send_env,
room_uid,
room_type,
gift_id,
gift_num,
gift_type,
play_effect,
total_gold_num,
total_diamond_num,
create_time,
gift_source,
mess_id
) VALUES (
#{record.sendRecordId},
#{record.uid},
#{record.partitionId},
#{record.reciveUid},
#{record.reciveType},
#{record.sendEnv},
#{record.roomUid},
#{record.roomType},
#{record.giftId},
#{record.giftNum},
#{record.giftType},
#{record.playEffect},
#{record.totalGoldNum},
#{record.totalDiamondNum},
#{record.createTime},
#{record.giftSource},
#{record.messId}
)
</insert>
</mapper>