mybatis-generator自动生成代码
来源:互联网 发布:如何下载bilibili mac 编辑:程序博客网 时间:2024/04/30 09:29
用了maven,首先在pom.xml中添加配置:
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version><tomcat.version>7.0.82</tomcat.version><mybatis-generator.version>1.3.2</mybatis-generator.version></properties>
<dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>${mybatis-generator.version}</version> </dependency>
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> </plugin> <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>然后在resources下添加配置文件:
<?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="F:\m2\repository\mysql\mysql-connector-java\5.1.40\mysql-connector-java-5.1.40.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://localhost/peimiapp" userId="root" password="123"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <javaModelGenerator targetPackage="com.hpm.blog.model" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <sqlMapGenerator targetPackage="com.hpm.blog.mapper" targetProject="src/main/resources"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <javaClientGenerator type="XMLMAPPER" targetPackage="com.hpm.blog.mapping" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <table tableName="t_hotcategories" domainObjectName="HotCategories" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> </context> </generatorConfiguration>生成代码的时候选中pom.xml点击右键,选中Run As 然后选中maven build....然后RUN,再刷新以下项目就会看到项目中已经自动生成dao、model、mapping相关文件
阅读全文
0 0
- Generator-Mybatis自动生成代码
- MyBatis Generator自动生成代码
- mybatis-generator自动生成代码
- mybatis自动生成代码generator
- MyBatis Generator 自动生成代码
- Mybatis-Generator自动生成代码
- MyBatis-generator 自动生成代码
- mybatis-generator自动生成代码
- mybatis-generator【mybatis代码自动生成】
- MBG(MyBatis Generator):MyBatis自动代码生成;
- mybatis mybatis-generator 代码自动生成工具
- 使用MyBatis-generator 自动生成MyBatis代码
- mybatis mybatis-generator 代码自动生成工具
- MyBatis使用Generator自动生成代码
- MyBatis使用Generator自动生成代码
- 用mybatis generator自动生成代码
- 使用MyBatis generator自动生成代码
- maven + MyBatis Generator 自动生成代码配置
- jsoup:一款使用 Java 语言开发的 HTML 解析器
- 深度学习第一课:使用autograd来自动求导
- 文本数据库,DateTime 类型新建数据库时(首次运行)出现错误
- centos 安装zookeeper
- Javascript 中call() , applay()理解
- mybatis-generator自动生成代码
- AngularJS(一)
- 新博客,新的开始,激励自己,稳步前进
- 欢迎使用CSDN-markdown编辑器
- 时间复杂度及空间复杂度
- 自定义画图的控件DrawView,可做草稿页面
- 接口-大学里的学生(Student)需要交学费,而研究生(Graduate)作为学生比较特殊,除了需要交学
- React Native Trying to resolve view with tag 518 which doesno't
- 【求助】winfrom怎么获取视频当前播放时间