- Notifications
You must be signed in to change notification settings - Fork0
License
NotificationsYou must be signed in to change notification settings
mivui/mybatis-extension-plugin
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
English |中文
- For ease of use, align with the main version number of mybatis-generator
- Introduction
- Support Mybatis3 and mybatis-dynamic-sql
- Note: You need to learn the use of mybatis-generator-maven-plugin firsthttp://mybatis.org/generator/running/runningWithMaven.html
- Note: You need to learn the configuration of the generated file firsthttp://mybatis.org/generator/configreference/xmlconfig.html
- Provide Entity, Dao extension
- Provide Service, Controller generation
<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>
LombokPlugin (lombok generation)
property | defaults | introduction |
---|---|---|
data | false | include getter,setter,toString,equalsAndHashCode,requiredArgsConstructor |
getter | false | getter |
setter | false | getter |
toString | false | toString |
equalsAndHashCode | false | equalsAndHashCode |
builder | false | builder |
noArgsConstructor | false | noArgsConstructor |
allArgsConstructor | false | allArgsConstructor |
requiredArgsConstructor | false | requiredArgsConstructor |
- 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)
property | defaults | introduction |
---|---|---|
serializable | false | Whether to implement Serializable |
dateSerialize | false | Date serialization only supports JDK 8 date types |
json | null | Date deserialization only supports JDK8 date types (options: fastJson, jackson) |
- 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)
property | defaults | introduction |
---|---|---|
suppressAllComments | false | Whether to remove the generated comments |
repository | null | Dao parent class, default is null |
- 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)
property | defaults | introduction |
---|---|---|
targetProject | null | Generate path example: src/main/java |
targetPackage | null | generate package path example: org.example.service |
basicService | null | service interface parent class default is null |
basicServiceImpl | null | serviceImpl parent class, default is null |
*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)
property | defaults | introduction |
---|---|---|
targetProject | null | Generate path example: src/main/java |
targetPackage | null | Generate package path example: org.example.controller |
rest | false | true for @RestController, false for @Controller |
respond | null | The controller returns the result set. The default is null |
- 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>
@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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.