mybatis-plus自定义表前缀
1 配置自定义表前缀
# 自定义表前缀
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
variables:
# 自定义表前缀
tablePrefix: my_
global-config:
db-config:
table-prefix: my_
2 通过程序获得自定义表前缀。
MybatisPlusProperties properties = SpringUtils.getBean(MybatisPlusProperties.class);
String tablePrefix = properties.getConfiguration().getVariables().getProperty("tablePrefix");
通过这种方式,业务代码可以为动态sql 获取自定义的表前缀。