mybatisplus雪花算法配置
时间: 2023-09-07 15:11:53 浏览: 188
***使用Scala编写。它生成的结果是一个64位的长整型数作为主键ID。在Mybatis Plus的全局配置中,可以通过以下方式配置雪花算法作为主键策略:
```
mybatis-plus:
configuration:
global-config:
db-config:
id-type: auto
```
这样配置后,Mybatis Plus会使用雪花算法生成主键ID,主键类型可以是Long或String,具体根据数据库的类型而定。例如在MySQL数据库中,主键类型为BIGINT或VARCHAR。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MyBatisPlus-ASSIGN_ID、ASSIGN_UUID策略、雪花算法及简化配置](https://blog.csdn.net/m0_61961937/article/details/126048049)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [MyabtisPlus雪花算法](https://blog.csdn.net/qq_47905231/article/details/125057079)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [MybatisPlus主键生成策略方法详解.docx](https://download.csdn.net/download/weixin_44609920/85901297)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文