From 08a82ee09c3f2dc04d520005b80e2961f93c7179 Mon Sep 17 00:00:00 2001 From: PIGCLOUD Date: Sat, 1 Aug 2026 12:00:43 +0800 Subject: [PATCH] fix(boot): randomize MyBatis-Plus snowflake node IDs --- pigx-boot/src/main/resources/application.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pigx-boot/src/main/resources/application.yml b/pigx-boot/src/main/resources/application.yml index 10f59c04f..b26230f3a 100644 --- a/pigx-boot/src/main/resources/application.yml +++ b/pigx-boot/src/main/resources/application.yml @@ -68,6 +68,10 @@ mybatis-plus: where-strategy: not_empty insert-strategy: not_empty update-strategy: not_null + # 雪花算法随机 worker-id / datacenter-id,避免多实例生成重复 ID (mybatis-plus#7135) + sequence: + worker-id: ${random.int(1,31)} + datacenter-id: ${random.int(1,31)} type-handlers-package: com.pig4cloud.pigx.common.data.handler configuration: jdbc-type-for-null: 'null'