Quantcast
Channel: OSCHINA 社区最新新闻
Viewing all articles
Browse latest Browse all 44834

Mybatis 通用 Mapper Starter 1.0.0 发布

$
0
0

通用Mapper都可以极大的方便开发人员。可以随意的按照自己的需要选择通用方法,还可以很方便的开发自己的通用方法。

极其方便的使用MyBatis单表的增删改查。

支持单表操作,不支持通用的多表联合查询。

通用 Mapper 支持 Mybatis-3.2.4 及以上版本

特别强调:不是表中字段的属性必须加 @Transient 注解

为了方便和 Spring Boot 集成,增加 mapper-spring-boot-starter 项目,在 Spring Boot 中使用通用 Mapper 只需要在 pom.xml 中添加:

<dependency>
    <groupId>tk.mybatis</groupId>
    <artifactId>mapper-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

默认情况下不需要任何配置,如果需要配置,可以在 Spring Boot 配置文件中以 mapper 为前缀进行配置。

例如:

mapper:
    mappers:
        - tk.mybatis.springboot.util.MyMapper
    not-empty: false
    identity: MYSQL

按照 Spring Boot 配置规则,属性的大写字母都变了带横线的小写字母。针对如 IDENTITY(对应i-d-e-n-t-i-t-y)全大写的属性提供了全小写的 identity 配置,如果 IDE 能自动提示,看自动提示即可。

有关 mapper-spring-boot-starter 的用法可以参考集成示例 MyBatis-Spring-Boot


Viewing all articles
Browse latest Browse all 44834

Trending Articles