Mybatis插件自动生成mapper.xml和dao
2017-02-17 00:00
501 查看
1.pom文件中导入插件jar包
2.generatorConfig.xml
<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </plugin>
2.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> <classPathEntry location="E:/mysql-connector-java-5.1.25.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressAllComments" value="true"/> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://10.20.22.211:3306/roadassistant" userId="root" password="mysql123"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <javaModelGenerator targetPackage="com.pingan.insurance.roadassistant.model" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <javaClientGenerator type="XMLMAPPER" targetPackage="com.pingan.insurance.roadassistant.dao" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <table tableName="rule_condition" domainObjectName="RuleCondition" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> <table tableName="rule_condition_extra" domainObjectName="RuleConditionExtra" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> <table tableName="rule_instance" domainObjectName="RuleInstance" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> <table tableName="rule_operator" domainObjectName="RuleOperator" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> <table tableName="rule_property" domainObjectName="RuleProperty" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> <table tableName="rule_result" domainObjectName="RuleResult" enableCountByExample="false" enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"/> </context> </generatorConfiguration> 在generatorConfig.xml上右击:Run As-->Run Configurations-->点击项目--->mybatis-generator:generate
相关文章推荐
- idea使用mybatis-generator插件自动生成eitity,dao,mapper
- 使用Mybatis-Generator自动生成Dao、model和mapper.xml相关文件
- 使用mybatis自带工具,自动生成表对应domain、mapper.xml以及dao
- Mybatis--使用mybatis generator插件映射数据库,自动生成pojo对象,dao接口,mapper.xml文件的方法
- 用mybatis-gennerator插件自动生成mybatis所需要的dao、bean、mapper xml文件
- 使用Mybatis-Generator自动生成Dao、model和mapper.xml相关文件
- Mybatis自动生成实体类、mapper.xml和dao
- Maven Web项目使用MyBatis_Generator_1.3.1自动生成javabean,dao,mapper.xml代码
- (开发笔记)转载:eclipse maven 插件 自动生成mybatis dao、mapper
- idea如何使用mybatis-generator插件自动生成eitity,dao,mapper
- 使用mybatis自带工具,自动生成表对应domain、mapper.xml以及dao
- mybatis反转自动生成dao、实体类和mapper.xml
- 使用mybatis自带工具,自动生成表对应domain、mapper.xml以及dao
- 利用Mybatis-generator自动生成java-bean和dao和mapper.xml
- eclipse maven 插件 自动生成mybatis dao、mapper 、pojo
- 使用mybatis自带工具,自动生成表对应domain、mapper.xml以及dao
- maven插件mybatis-generator自动生成实体类、mapper.xml、mapper.java文件
- 使用mybatis自动生成Dao,Mapper.xml,Entity
- 2分钟使用mybatisGenerator自动生成dao和mapper文件——使用cmd命令行
- 如何去掉mybatis自动生成的mapper.xml文件背景色