Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

mivui/mybatis-extension-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English |中文


Add dependency (example)
<dependencies>  <dependency>    <groupId>io.github.mioxs</groupId>    <artifactId>mybatis-extension-plugin</artifactId>    <version>1.4.2</version>    <scope>runtime</scope>    <optional>true</optional>  </dependency></dependencies><build><plugins>  <plugin>    <groupId>org.mybatis.generator</groupId>    <artifactId>mybatis-generator-maven-plugin</artifactId>    <version>1.4.1</version>    <executions>      <execution>        <id>Generate MyBatis Artifacts</id>        <phase>deploy</phase>        <goals>          <goal>generate</goal>        </goals>      </execution>    </executions>    <configuration>      <verbose>true</verbose>      <overwrite>true</overwrite>    </configuration>    <dependencies><!--mysql As an example-->      <dependency>        <groupId>mysql</groupId>        <artifactId>mysql-connector-java</artifactId>        <version>8.0.31</version>      </dependency><!--mybatis-extension-plugin-->      <dependency>        <groupId>io.github.mioxs</groupId>        <artifactId>mybatis-extension-plugin</artifactId>        <version>1.4.2</version>      </dependency>    </dependencies>  </plugin></plugins></build>

Plugin usage

LombokPlugin (lombok generation)

propertydefaultsintroduction
datafalseinclude getter,setter,toString,equalsAndHashCode,requiredArgsConstructor
getterfalsegetter
setterfalsegetter
toStringfalsetoString
equalsAndHashCodefalseequalsAndHashCode
builderfalsebuilder
noArgsConstructorfalsenoArgsConstructor
allArgsConstructorfalseallArgsConstructor
requiredArgsConstructorfalserequiredArgsConstructor
Examples
  • The <plugin> element is a child element of the <context> element. Any number of plugins can be specified in the context.
<plugintype="io.github.mioxs.mybatis.LombokPlugin">    <propertyname="data"value="true"/>    <propertyname="builder"value="true"/>    <propertyname="noArgsConstructor"value="true"/>    <propertyname="allArgsConstructor"value="true"/></plugin>

DomainPlugin (Entity class extension)

propertydefaultsintroduction
serializablefalseWhether to implement Serializable
dateSerializefalseDate serialization only supports JDK 8 date types
jsonnullDate deserialization only supports JDK8 date types (options: fastJson, jackson)
Examples
  • The <plugin> element is a child element of the <context> element. Any number of plugins can be specified in the context.
<plugintype="io.github.mioxs.mybatis.DomainPlugin">    <propertyname="serializable"value="true"/>    <propertyname="dateSerialize"value="true"/>    <propertyname="json"value="jackson"/></plugin>

RepositoryPlugin (Data Access Object DAO Extension)

propertydefaultsintroduction
suppressAllCommentsfalseWhether to remove the generated comments
repositorynullDao parent class, default is null
Examples
  • The <plugin> element is a child element of the <context> element. Any number of plugins can be specified in the context.
<plugintype="io.github.mioxs.mybatis.RepositoryPlugin">    <propertyname="suppressAllComments"value="true"/>    <propertyname="repository"value="org.example.MybatisRepository"/></plugin>

ServicePlugin (Service generation)

propertydefaultsintroduction
targetProjectnullGenerate path example: src/main/java
targetPackagenullgenerate package path example: org.example.service
basicServicenullservice interface parent class default is null
basicServiceImplnullserviceImpl parent class, default is null
Examples

*The <plugin> element is a child element of the <context> element. Any number of plugins can be specified in the context.

<plugintype="io.github.mioxs.mybatis.ServicePlugin">   <propertyname="targetProject"value="src/main/java"/>   <propertyname="targetPackage"value="org.example.service"/>   <propertyname="basicService"value="org.example.BaseService"/>   <propertyname="basicServiceImpl"value="org.example.BaseServiceImpl"/></plugin>

ControllerPlugin (Controller generation)

propertydefaultsintroduction
targetProjectnullGenerate path example: src/main/java
targetPackagenullGenerate package path example: org.example.controller
restfalsetrue for @RestController, false for @Controller
respondnullThe controller returns the result set. The default is null
Examples
  • The <plugin> element is a child element of the <context> element. Any number of plugins can be specified in the context.
<plugintype="io.github.mioxs.mybatis.ControllerPlugin">   <propertyname="targetProject"value="src/main/java"/>   <propertyname="targetPackage"value="org.example.controller"/>   <propertyname="rest"value="true"/>   <propertyname="respond"value="org.example.Respond"/></plugin>
Generate impressions (partial code)
@Slf4j@RestController@RequestMapping("example")publicclassExampleController {@AutowiredprivateExampleServiceexampleService;@GetMapping("findAll")publicRespondfindAll() {returnnull;    }//...}

Generate

  • Idea opens the right side maven->plugins->mybatis-generator-> mybatis-generator:generator Click to execute
  • Or mvn mybatis-generator:generator

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp