MyBatis代码自动生成
来源:互联网 发布:预算软件有哪些 编辑:程序博客网 时间:2024/06/05 12:03
一、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-generator/generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <executions> <execution> <id>Generate MyBatis Artifacts</id> <goals> <goal>generate</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.2</version> </dependency> </dependencies></plugin>
二、配置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="mysql-connector-java-5.1.30.jar"/> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressDate" value="true"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://ip/数据库名?allowMultiQueries=true" userId="用户名" password="密码"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <javaModelGenerator targetPackage="生成实体类的包" 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="生成dao层的包" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <table tableName="表名" domainObjectName="生成对象名" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"></table> </context></generatorConfiguration>
三、配置maven
mybatis-generator:generate
阅读全文
0 0
- MyBatis代码自动生成
- mybatis 自动生成代码
- Mybatis自动生成代码
- Mybatis自动生成代码
- MyBatis代码自动生成
- Mybatis 代码自动生成
- MyBatis代码自动生成
- mybatis代码自动生成
- Mybatis代码自动生成
- MyBatis自动生成代码
- Mybatis自动生成代码
- mybatis 自动生成代码
- mybatis自动生成代码
- Mybatis自动生成代码
- Mybatis自动生成代码
- Mybatis自动生成代码
- Mybatis自动生成代码
- mybatis自动生成代码
- Learning Tensorflow (2)
- 运行adb 报adb已经停止工作解决方法
- 首次开通技术博客,做个标记
- Codeforces 832D. Misha, Grisha and Underground【LCA】
- 产品设计14招,招招有用(下)
- MyBatis代码自动生成
- linux,Ubuntu设置MySQL远程访问权限
- ZooKeeper学习第一期---Zookeeper简单介绍
- Oracle插入或修改 报ORA-01704: 文字字符串太长
- 哪门编程语言最值钱?居然不是PHP
- MySql 实现多表更新
- Request和Response
- Linux grep 显示前后几行的信息
- 解决adb kill-server卡住不动的问题