MyBatis 配置文件位置,如果您有单独的 MyBatis 配置,请将其路径配置到 configLocation 中。如果是springboot中做如下配置:
#mybatis核心配置文件的位置配置
mybatis-plus:
config-location: classpath:mybatis-config.xml
MyBatis Mapper 所对应的 XML 文件位置,如果您在 Mapper 中有自定义方法(XML 中有自定义实现),需要进行该配置,告诉 Mapper 所对应的 XML 文件位置。
#mapper.xml文件的路径
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN(下划线命名) 到经典 Java 属;
性名 aColumn(驼峰命名) 的类似映射。
简单点说就是把数据库的命名规则自动改成java的命名规则
在mybatis-plus中默认是开启的(true);
在mybatis中默认是关闭的;
#关闭自动驼峰映射,该参数不能和mybatis-plus.config-location同时存在;
mybatis-plus:
configuration:
map-underscore-to-camel-case: false
全局地开启或关闭配置文件中的所有映射器已经配置的任何缓存,默认为 true。
#全局关闭缓存配置
mybatis-plus:
configuration:
cache-enabled: false
全局默认主键类型,设置后,即可省略实体对象中的@TableId(type = IdType.AUTO)配置。
#全局默认主键自增
mybatis-plus:
global-config:
db-config:
id-type: auto
表名前缀,全局配置后可省略@TableName()配置。
#全局配置表前缀
mybatis-plus:
global-config:
db-config:
table-prefix: tb_