mybatis-plus:
## mapper文件位置
mapper-locations: classpath*:/mapper/**/*.xml
## 别名包设置,在mapper.xml中可直接用类名
type-aliases-package: com.xx.xx.entity
global-config:
db-config:
## 生成ID方式: AUTO 数据库自增 INPUT 自己输入 ASSIGN_UUID 默认生成器
id-type: auto
## 逻辑删除字段
logic-delete-field: deleted
## 逻辑删除已删除值
logic-delete-value: 1
## 逻辑删除未删除值
logic-not-delete-value: 0
configuration:
## 自动驼峰命名规则映射
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
1 type-aliases-package: 配了此项,在mapper.xml文件的resultMap的type或者parameterType使用自定义的pojo时,可以只写一个实体名 (而不用写全限定名)
2 @MapperScan(basePackages="com.ostrich.*.repository")
配置文件中的:mapper-locations:xxxxx
这两个配置缺一不可:@MapperScan是扫描mapper接口的也就是dao类;mapper-locations是扫描mapper.xml的
PS: springBoot整合mybatis时,需要在spring boot的启动类中添加mybatis的包扫描路径,或@Mapper注解
或者:
原文:https://www.cnblogs.com/caesar-the-great/p/12842177.html