mybatis-generator-ext

extension for mybatis-generator

Лицензия

Лицензия

Категории

Категории

MyBatis Данные ORM
Группа

Группа

me.aifaq
Идентификатор

Идентификатор

mybatis-generator-ext
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

mybatis-generator-ext
extension for mybatis-generator
Ссылка на сайт

Ссылка на сайт

https://github.com/aifaq/mybatis-generator-ext
Система контроля версий

Система контроля версий

https://github.com/aifaq/mybatis-generator-ext

Скачать mybatis-generator-ext

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.aifaq/mybatis-generator-ext/ -->
<dependency>
    <groupId>me.aifaq</groupId>
    <artifactId>mybatis-generator-ext</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/me.aifaq/mybatis-generator-ext/
implementation 'me.aifaq:mybatis-generator-ext:1.0'
// https://jarcasting.com/artifacts/me.aifaq/mybatis-generator-ext/
implementation ("me.aifaq:mybatis-generator-ext:1.0")
'me.aifaq:mybatis-generator-ext:jar:1.0'
<dependency org="me.aifaq" name="mybatis-generator-ext" rev="1.0">
  <artifact name="mybatis-generator-ext" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.aifaq', module='mybatis-generator-ext', version='1.0')
)
libraryDependencies += "me.aifaq" % "mybatis-generator-ext" % "1.0"
[me.aifaq/mybatis-generator-ext "1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.mybatis.generator : mybatis-generator-core jar 1.3.7

provided (3)

Идентификатор библиотеки Тип Версия
mysql : mysql-connector-java jar 5.1.47
org.springframework.data : spring-data-commons jar 2.0.9.RELEASE
org.mybatis : mybatis jar 3.4.6

Модули Проекта

Данный проект не имеет модулей.

mybatis-generator-ext

<dependency>
	<groupId>me.aifaq</groupId>
	<artifactId>mybatis-generator-ext</artifactId>
	<version>VERSION</version>
</dependency>

扩展插件

MapperPlugin

<plugin type="me.aifaq.mybatis.generator.plugins.MapperPlugin" />

在生成的Mapper类上添加注解 @org.apache.ibatis.annotations.Mapper

ForceSkipMergeSqlMapPlugin

<plugin type="me.aifaq.mybatis.generator.plugins.ForceSkipMergeSqlMapPlugin" />

强制sql mapper.xml 不做merge操作

SpringDataPagePlugin

<plugin type="me.aifaq.mybatis.generator.plugins.SpringDataPagePlugin" />

使用 spring-data-commons 中的分页Bean实现分页查询。

原理:

在生成的 **Example 类中添加属性:

  protected org.springframework.data.domain.Pageable page;

同时在生成的 sql mapper.xml 中添加该属性的逻辑判断,如下:

  <sql id="SpringDataPageSql">
    <if test="page != null">
      <if test="page.sort != null">
        ORDER BY
        <foreach collection="page.sort" item="order" index="index" open="" separator="," close="">
          ${order.property,jdbcType=VARCHAR} ${order.direction,jdbcType=VARCHAR}
        </foreach>
      </if>
      LIMIT #{page.offset,jdbcType=INTEGER},#{page.pageSize,jdbcType=INTEGER}
    </if>
  </sql>

Версии библиотеки

Версия
1.0
0.1