幸运24-雪花主键-mq-无锁化唯一主键插入

This commit is contained in:
2025-09-11 22:27:56 +08:00
parent 5562bbafc6
commit 2b2c615b28
13 changed files with 235 additions and 38 deletions

View File

@@ -1337,6 +1337,7 @@ public enum RedisKey {
lucky_24_user_history,
lucky_24_user_lock,
lucky_24_robot_push_msg,
lucky_24_record_message, // 礼物消息的状态
lucky_24_status, // 礼物消息的状态
lock_lucky_24_message, // 消费送礼物消息锁
lucky_24_user_10w_stat, // 消费送礼物消息锁

View File

@@ -11,7 +11,7 @@ import java.util.Date;
@Data
public class Lucky24Record {
@TableId(type = IdType.AUTO)
@TableId(type = IdType.INPUT)
private Long id;
private Integer partitionId;
private Long uid;

View File

@@ -11,6 +11,11 @@ import java.util.List;
public interface Lucky24RecordMapper extends BaseMapper<Lucky24Record> {
/**
* 批量插入记录,使用 INSERT IGNORE 忽略重复记录
*/
int insertIgnore(@Param("record") Lucky24Record record);
List<Lucky24PlatformStat> listPlatform(@Param("zoneDate")String zoneDate, @Param("partitionId") Integer partitionId,
@Param("poolTypeList")List<Integer> poolTypeList,
@Param("startTime") Date startTime, @Param("endTime") Date endTime);

View File

@@ -2,6 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.accompany.sharding.mapper.Lucky24RecordMapper">
<insert id="insertIgnore">
INSERT IGNORE INTO lucky_24_record (
id,
partition_id,
uid,
receiver_uid,
room_uid,
gift_id,
gift_gold_price,
gift_num,
pool_type,
pool_id,
is_supplement,
draw_multiple,
after_multiple,
win_gold_num,
create_time,
stock_result,
mess_id
) VALUES
(
#{record.id},
#{record.partitionId},
#{record.uid},
#{record.receiverUid},
#{record.roomUid},
#{record.giftId},
#{record.giftGoldPrice},
#{record.giftNum},
#{record.poolType},
#{record.poolId},
#{record.isSupplement},
#{record.drawMultiple},
#{record.afterMultiple},
#{record.winGoldNum},
#{record.createTime},
#{record.stockResult},
#{record.messId}
)
</insert>
<select id="listPlatform" resultType="com.accompany.sharding.vo.Lucky24PlatformStat">
select #{zoneDate} as `date`,
#{partitionId} as partition_id,