Java MyBatis自动生成映射文件
2017-06-29 16:36
405 查看
参考:http://blog.csdn.net/tolcf/article/details/50835165 文章中提供了jar包下载地址
generatorConfig.xml 如下,mybatis自动化工具会根据该文件来查找数据源,生成对应的VO对象,mapper文件,example对象
generatorConfig.xml 如下,mybatis自动化工具会根据该文件来查找数据源,生成对应的VO对象,mapper文件,example对象
<?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="D:\generator\mysql-connector-java-5.1.34.jar" /> <!-- <classPathEntry location="C:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar" />--> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressAllComments" value="true" /> <!--生成注释--> <property name="suppressDate" value="true" /> <!--生成注释包含时间戳--> </commentGenerator> <!-- 数据库链接URL、用户名、密码 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/vpush_dev?characterEncoding=utf8" userId="yq" password="123456"> <!--<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="msa" password="msa">--> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- 生成模型的包名和位置 --> <javaModelGenerator targetPackage="yq.model" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- 生成的映射文件包名和位置 --> <sqlMapGenerator targetPackage="yq.mapping" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- 生成DAO的包名和位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="yq.dao" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- 要生成那些表(更改tableName和domainObjectName就可以) --> <table schema="test" tableName="device"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="device_push"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="model_info"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="os_version"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="push_task"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="test_process"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="test_tool"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="tool_version"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="dic_config"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="server_node"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="test_item"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="test_report"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> <table schema="test" tableName="user_info"> <generatedKey column="ID" sqlStatement="Mysql" identity="true"/> </table> </context> </generatorConfiguration>
相关文章推荐
- 命令+mybatis-generator插件自动生成Mapper映射文件
- Mybatis使用generator自动生成映射配置文件信息
- Mybatis使用generator自动生成映射配置文件信息
- hibernate自动生成映射文件和java实体类出现的问题
- 利用MyBatis生成器自动生成实体类、DAO接口和Mapping映射文件
- Mybatis-Generator自动生成映射配置文件和CRUD操作
- 通过mybatis工具generatorConfig.xml自动生成实体,DAO,映射文件
- MyBatis之自动生成实体类及映射文件《二》
- Mybatis使用generator自动生成映射配置文件信息
- mybatis怎样自动生成java类,配置文件?
- mybatis-generator自动生成java代码和配置文件的注意事项
- Mybatis 自动生成dao及映射文件
- 使用mybatis的generator自动生成映射文件
- Mybatis使用generator自动生成映射配置文件信息
- 使用generator自动生成Mybatis映射配置文件
- mybatis自动生成映射文件实体类接口
- mybatis自动生成mapper,dao,映射文件
- java笔记之使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件2种方法
- Mybatis自动生成实体类,映射文件,以及dao层接口。
- Mybatis使用generator自动生成映射配置文件信息