指定全局配置文件位置
mybatis-plus:
# 指定全局的配置文件
config-location: classpath:mybatis-config.xml
配置Mapper接口对应XML文件的位置
mybatis-plus:
# 配置Mapper接口对应xml文件位置
mapper-locations: classpath*:com/hrm/**/mapper/xml/*Mapper.xml
配置别名包扫描路径
mybatis-plus:
# 配置别名包扫描路径
type-aliases-package: com.hrm.*.entity
配置是否进行驼峰映射
mybatis-plus:
configuration:
# 配置是否自动进行驼峰映射
map-underscore-to-camel-case: true
配置是否开启缓存
mybatis-plus:
configuration:
# 配置是否开启缓存
cache-enabled: true
配置全局主键生成策略
在配置文件中配置了全局ID生成策略以后,就不需要在实体类上再单独进行配置了
mybatis-plus:
global-config:
db-config:
# 配置实体类的全局ID生成策略
id-type: auto
配置表名前缀
在Mybatis plus中会默认以实体类的类名为表名,在数据库中进行查询。如果数据库中的表名为tb_类名,那么就无法进行查询了。下面的参数配置,就是为了解决这个问题的
mybatis-plus:
global-config:
db-config:
# 配置全局表名前缀
table-prefix: tb_
评论 (0)