标签:执行 dbcc pass pre core big comm 打开 1.4
地址:https://github.com/mybatis/generator/releases
我使用的是 mybatis-generator-core-1.3.7
官网: http://www.mybatis.org/generator/configreference/xmlconfig.html
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE generatorConfiguration 3 PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" 4 "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> 5 <generatorConfiguration> 6 <!--数据库驱动--> 7 <classPathEntry location="mysql-connector-java-5.1.4.jar"/> 8 <context id="DB2Tables" targetRuntime="MyBatis3"> 9 <commentGenerator> 10 <property name="suppressDate" value="true"/> 11 <property name="suppressAllComments" value="true"/> 12 </commentGenerator> 13 <!--数据库链接地址账号密码--> 14 <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/test" userId="root" password="123456"> 15 </jdbcConnection> 16 <javaTypeResolver> 17 <property name="forceBigDecimals" value="false"/> 18 </javaTypeResolver> 19 <!--生成Model类存放位置--> 20 <javaModelGenerator targetPackage="com.ice.model" targetProject="d:\src"> 21 <property name="enableSubPackages" value="true"/> 22 <property name="trimStrings" value="true"/> 23 </javaModelGenerator> 24 <!--生成映射文件存放位置--> 25 <sqlMapGenerator targetPackage="com.ice.mapper" targetProject="d:\src"> 26 <property name="enableSubPackages" value="true"/> 27 </sqlMapGenerator> 28 <!--生成Dao类存放位置--> 29 <javaClientGenerator type="XMLMAPPER" targetPackage="com.ice.dao" targetProject="d:\src"> 30 <property name="enableSubPackages" value="true"/> 31 </javaClientGenerator> 32 <!--生成对应表及类名 *ByExample可以根据情况选择是否开启--> 33 <table tableName="customer" domainObjectName="Customer" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> 34 </table> 35 </context> 36 </generatorConfiguration>
在mybatis-generator目录按住Shift键,右键鼠标选择"在此处打开命令窗口",执行
java -jar mybatis-generator-core-1.3.7.jar -configfile generatorConfig.xml -overwrite
如果不写 -overwrite,那么生产的文件不会覆盖,而是产生新的版本.
比如,第一次执行,CustomerMapper.java
第二次执行,CustomerMapper.java.1,第三次执行 CustomerMapper.java.2
spring入门(七) spring mvc+mybatis+generator
标签:执行 dbcc pass pre core big comm 打开 1.4
原文地址:https://www.cnblogs.com/ICE_Inspire/p/9744721.html