mybatis-generator-pagination-parent

pagination plugin for mybatis generator

License

License

Categories

Categories

MyBatis Data ORM
GroupId

GroupId

com.rosegun
ArtifactId

ArtifactId

mybatis-generator-pagination-parent
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

pom
Description

Description

mybatis-generator-pagination-parent
pagination plugin for mybatis generator
Project URL

Project URL

https://github.com/rosegun/mybatis-generator-pagination
Source Code Management

Source Code Management

https://github.com/rosegun/mybatis-generator-pagination

Download mybatis-generator-pagination-parent

How to add to project

<!-- https://jarcasting.com/artifacts/com.rosegun/mybatis-generator-pagination-parent/ -->
<dependency>
    <groupId>com.rosegun</groupId>
    <artifactId>mybatis-generator-pagination-parent</artifactId>
    <version>1.0.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.rosegun/mybatis-generator-pagination-parent/
implementation 'com.rosegun:mybatis-generator-pagination-parent:1.0.1'
// https://jarcasting.com/artifacts/com.rosegun/mybatis-generator-pagination-parent/
implementation ("com.rosegun:mybatis-generator-pagination-parent:1.0.1")
'com.rosegun:mybatis-generator-pagination-parent:pom:1.0.1'
<dependency org="com.rosegun" name="mybatis-generator-pagination-parent" rev="1.0.1">
  <artifact name="mybatis-generator-pagination-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.rosegun', module='mybatis-generator-pagination-parent', version='1.0.1')
)
libraryDependencies += "com.rosegun" % "mybatis-generator-pagination-parent" % "1.0.1"
[com.rosegun/mybatis-generator-pagination-parent "1.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • mybatis-generator-pagination
  • sample

mybatis generator分页插件 (mybatis generator pagination plugin)

使用方法(how to use)

按照原来使用mybatis generator的方法,只是多加了依赖
as same as the way you use mybatis generator, besides, add one more dependency in your pom.

一切需要手写mapper、DTO等复杂方式来实现分页的都是耍流氓;
everything need to write mappers and DTOs by yourself is bullshit!

一切需要复杂配置的插件都是耍流氓;
all complex configurations are bullshit.

此插件目标是使用最简单的方式实现物理分页,不需要手写代码!!!
aim to provide the simplest way to carry out physical pagination!!!

1.在依赖中加入(in your dependency):

<dependency>
    <groupId>com.rosegun</groupId>
    <artifactId>mybatis-generator-pagination</artifactId>
    <version>1.0.1</version>
</dependency>

2.在插件中加入(in your plugin dependency):

<plugin>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-maven-plugin</artifactId>
    <version>1.3.5</version>
    <configuration>
        <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
        <verbose>true</verbose>
        <overwrite>true</overwrite>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.42</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-core</artifactId>
            <version>1.3.5</version>
        </dependency>
        <!-- only add this dependency -->
        <dependency>
            <groupId>com.rosegun</groupId>
            <artifactId>mybatis-generator-pagination</artifactId>
            <version>1.0.1</version>
        </dependency>
    </dependencies>
</plugin>

3.在generatorConfig.xml配置文件中加入分页插件(in your generatorConfig.xml):

<plugin type="com.rosegun.plugin.MysqlLimitPlugin"/>

4.生成(generate)

mvn mybatis-generator:generate

唯一一个参数(one more parameter)

为了方便配合spring使用,插件生成的mapper会默认加入 @Repository注解,这样可以避免在IDE中看到警告, 如果你不是处女座或者不需要这个注解,那么在generatorConfig.xml文件中加入如下参数:
to integrate with Springframework and avoid warnings in IDE, this plugin will add @Repositoryto mappers as default, if you're not Virgo or you don't need this annotation, add a property in your generatorConfig.xml

<plugin type="com.rosegun.plugin.MysqlLimitPlugin">
    <property name="addRepositoryAnnotation" value="false"/>
</plugin>

Versions

Version
1.0.1