init commit
This commit is contained in:
98
README.md
Normal file
98
README.md
Normal file
@@ -0,0 +1,98 @@
|
||||
# tape-mybatis-generator-plugin
|
||||
> MyBatis 代码生成插件
|
||||
|
||||
|
||||
## Uses
|
||||
in `pom.xml`
|
||||
```
|
||||
<build>
|
||||
<finalName>application</finalName>
|
||||
<plugins>
|
||||
<!-- your other plugins -->
|
||||
<!-- add mybatis plugin -->
|
||||
<plugin>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<configuration>
|
||||
<configurationFile>src/main/resources/mybatis.generator.xml</configurationFile>
|
||||
<overwrite>true</overwrite>
|
||||
<verbose>true</verbose>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Generate MyBatis Artifacts</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iqudoo.framework</groupId>
|
||||
<artifactId>tape-mybaits-generator-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<systemPath>${project.basedir}/src/lib/tape-mybaits-generator-plugin-1.0-SNAPSHOT.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
```
|
||||
in `mybatis.generator.xml`
|
||||
```
|
||||
<property name="viewKeyWords" value="VIEW_,V_"/>
|
||||
<property name="targetProject" value="src/main/java"/>
|
||||
<property name="modelPackage" value="com.iqudoo.platform.application.database.model"/>
|
||||
<property name="mapperPackage" value="com.iqudoo.platform.application.database.mapper"/>
|
||||
<property name="facadeRepositoryPackage" value="com.iqudoo.platform.application.facade.repository"/>
|
||||
<property name="domainRepositoryPackage" value="com.iqudoo.platform.application.domain.repository"/>
|
||||
<property name="facadeRepoviewPackage" value="com.iqudoo.platform.application.facade.repoview"/>
|
||||
<property name="domainRepoviewPackage" value="com.iqudoo.platform.application.domain.repoview"/>
|
||||
|
||||
<plugin type="com.iqudoo.framework.mybatis.TapeMybatisGeneratorPlugin"/>
|
||||
<plugin type="com.iqudoo.framework.mybatis.TapeRepositoryGeneratorPlugin"/>
|
||||
<plugin type="com.iqudoo.framework.mybatis.TapeRepoviewGeneratorPlugin"/>
|
||||
```
|
||||
|
||||
## Table Template
|
||||
```
|
||||
DROP TABLE IF EXISTS `your_table_name`;
|
||||
CREATE TABLE `your_table_name` (
|
||||
`guid` bigint(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'GUID',
|
||||
-- ----------------------------
|
||||
-- add your other table field
|
||||
-- ----------------------------
|
||||
`is_hidden` int(0) NOT NULL DEFAULT 0 COMMENT '隐藏标志',
|
||||
`is_delete` int(0) NOT NULL DEFAULT 0 COMMENT '删除标志',
|
||||
`delete_token` varchar(32) NULL DEFAULT '' COMMENT '删除令牌',
|
||||
`data_version` int(0) NOT NULL DEFAULT 0 COMMENT '数据版本',
|
||||
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
|
||||
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
|
||||
PRIMARY KEY (`guid`) USING BTREE
|
||||
) ENGINE = InnoDB COMMENT = '应用基础信息表' ROW_FORMAT = Dynamic;
|
||||
```
|
||||
in `mybatis.generator.xml`
|
||||
```
|
||||
<!-- your_table_name -->
|
||||
<table tableName="your_table_name"
|
||||
domainObjectName="YourTableName"
|
||||
enableInsert="true"
|
||||
enableDeleteByPrimaryKey="true"
|
||||
enableUpdateByPrimaryKey="true"
|
||||
enableCountByExample="true"
|
||||
enableUpdateByExample="true"
|
||||
enableDeleteByExample="true"
|
||||
enableSelectByExample="true"
|
||||
selectByExampleQueryId="false">
|
||||
<property name="useActualColumnNames" value="false"/>
|
||||
</table>
|
||||
```
|
||||
Reference in New Issue
Block a user