mybatis逆向工程生成相关文件
2017-11-30 10:47
267 查看
在前面一篇博文中谢了使用插件方式生成mybatis相关文件,下面介绍下使用maven依赖的方式。这里演示使用idea
对应目录下新建mybatis-generatorConfig.xml
运行
1. pom.xml配置
<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <configurationFile>src/main/resources/mybatis-generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.34</version> </dependency> </dependencies> </plugin>
2.新建mybatis-generatorConfig.xml
在pom.xml配置的<configurationFile>src/main/resources/mybatis-generatorConfig.xml</configurationFile>
对应目录下新建mybatis-generatorConfig.xml
3.配置mybatis-generatorConfig.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <context id="mysqlgenerator" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressAllComments" value="true"/> <!--是否取消注释--> <property name="suppressDate" value="true"/> <!--是否生成注释时间戳--> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/springsecurity?characterEncoding=UTF-8" userId="root" password="299522" /> <!--指定生成java类型--> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <javaModelGenerator targetPackage="com.awna.model" targetProject="src/main/java" /> <sqlMapGenerator targetPackage="mappers" targetProject="src/main/resources" /> <javaClientGenerator type="XMLMAPPER" targetPackage="com.awna.dao" targetProject="src/main/java" /> <table tableName="SYS_USER" domainObjectName="SysUser" enableCountByExample="false" enableUpdateByExample="false" enableSelectByExample="false" enableDeleteByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false"/> </table> <table tableName="SYS_ROLE" domainObjectName="SysRole" enableCountByExample="false" enableUpdateByExample="false" enableSelectByExample="false" enableDeleteByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false"/> </table> <table tableName="SYS_ROLE_USER" domainObjectName="SysRoleUser" enableCountByExample="false" enableUpdateByExample="false" enableSelectByExample="false" enableDeleteByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false"/> </table> <table tableName="Sys_permission" domainObjectName="SysPermission" enableCountByExample="false" enableUpdateByExample="false" enableSelectByExample="false" enableDeleteByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false"/> </table> <table tableName="Sys_permission_role" domainObjectName="SysPermissionRole" enableCountByExample="false" enableUpdateByExample="false" enableSelectByExample="false" enableDeleteByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false"/> </table> </context> </generatorConfiguration>
4.运行逆向工程
首先配置idea运行
相关文章推荐
- mybatis自动生成相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator命令提示符方式自动生成Dao、Model、Mapping相关文件
- 利用mybatis_generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- mybatis逆向工程生成文件解析
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件