Mybatis-Flex统一设置数据库表主键为雪花算法
This commit is contained in:
parent
06a7540d4d
commit
a9a3e1a057
@ -11,8 +11,9 @@ import com.github.pagehelper.PageInterceptor;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mybatis支持*匹配扫描包
|
* Mybatis支持*匹配扫描包
|
||||||
|
* Mybatis-Flex配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author dataprince数据小王子
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan("com.ruoyi.**.mapper")
|
@MapperScan("com.ruoyi.**.mapper")
|
||||||
@ -31,5 +32,11 @@ public class MyBatisConfig
|
|||||||
// 关闭banner
|
// 关闭banner
|
||||||
globalConfig.setPrintBanner(false);
|
globalConfig.setPrintBanner(false);
|
||||||
|
|
||||||
|
//统一设置数据库表主键为雪花算法
|
||||||
|
FlexGlobalConfig.KeyConfig keyConfig = new FlexGlobalConfig.KeyConfig();
|
||||||
|
keyConfig.setKeyType(KeyType.Generator);
|
||||||
|
keyConfig.setValue(KeyGenerators.snowFlakeId);
|
||||||
|
//keyConfig.setBefore(true);
|
||||||
|
FlexGlobalConfig.getDefaultConfig().setKeyConfig(keyConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user