intel idea2017 mybatis自动创建代码
来源:互联网 发布:linux上安装redhat 编辑:程序博客网 时间:2024/05/29 02:20
参考博文:http://blog.csdn.net/noaman_wgs/article/details/54409301
第一步:在pom.xml加入
<plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.30</version> </dependency> </dependencies> <configuration> <overwrite>true</overwrite> </configuration> </plugin> </plugins>
第二步:添加generatorConfig.xml,其中jdbcConnection,javaModelGenerator,table三个节点必须有
<?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="suppressDate" value="true"/> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true"/> </commentGenerator> <!-- 数据库的相关配置 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/homework" userId="root" password="root" /> <!-- 实体类生成的位置 --> <javaModelGenerator targetPackage="cn.wxz1997.domain" targetProject="src/main/java"> <!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false --> <property name="enableSubPackages" value="true" /> <!-- 设置是否在getter方法中,对String类型字段调用trim()方法 --> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- *Mapper.xml 文件的位置 --> <sqlMapGenerator targetPackage="cn.wxz1997.mapper" targetProject="src/main/java"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- Mapper 接口文件的位置 --> <javaClientGenerator targetPackage="cn.wxz1997.dao" targetProject="src/main/java" type="XMLMAPPER"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- table表生成对应的DoaminObject --> <table tableName="user_t" domainObjectName="User"></table> </context></generatorConfiguration>
第三步:
完成
阅读全文
0 0
- intel idea2017 mybatis自动创建代码
- MyBatis自动创建代码
- mybatis自动创建代码
- myBatis 自动创建代码
- MyBatis Generator自动创建代码
- 使用MyBatis自动创建代码
- MyBatis Generator 自动创建代码
- MyBatis Generator自动创建代码
- MyBatis自动创建代码工具
- MyBatis Generator自动创建代码
- MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- Ubuntu远程登录服务器失败
- Python 3.6.1 安装mlab 出现二进制和str文本格式转换问题
- LCX端口转发源码分析
- 数据链路层:ARP协议详解(绝对经典)
- python assert断言语句
- intel idea2017 mybatis自动创建代码
- MAVEN 下载和安装 配置
- iOS xcode 9 注释快捷键
- python 3 爬取百度图片
- Github简单操作详解——初识Git
- 九度OJ题目1053:互换最大最小数
- rapidjson组装map和数组array的代码示例
- The reference to entity "characterEncoding" must end with the ';' delimiter.
- The C Programming Language 练习题2-5