How to set up work-id and database-id in mybatis plus distributed id generation strategy

< H1 > description: < / H1 >

recently using the mybatis plus-java framework, which includes distributed id generation and type=IdType.ID_WORDER_STR,
as far as I know, snowflake id needs to be set up

1. Start timestamp 2. Machine id 3.
of data Center id

but I don"t see how to set these three options in the configuration of mybatis plus. What to do

add: all the snowflake demo I see on the Internet need to set these three options, and the program I am currently developing has CPP and py. if the machine id and dbid of the mybatis plus on the java side are not set, I am worried about the risk of id duplication
Mar.19,2021

although I didn't find out how to configure the three attributes, after looking at the source code of the framework, I copy a com.baomidou.mybatisplus.toolkit.Sequence.java class and put it in the source package of the current project. Then, there is no
so that's it


.


clipboard.png

, : Thu Nov 04 09:42:54 CST 2010 .

clipboard.png with configuration items


ask the author whether he has found a solution

Menu