Mybatis generator的使用主要是 generatorConfig.xml配置文件的使用

Generatorconfig.xml代码
" wmode="transparent"> 收藏代码
<?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>
<properties resource="util/generatorConfig.properties" />
<!-- classPathEntry:数据库的JDBC驱动,换成你自己的驱动位置 -->

<classPathEntry location="${classPath}" />
<context id="MBG" targetRuntime="MyBatis3"
defaultModelType="conditional">
<plugin type="plugin.SelectByPagePlugin" />
<!-- 此处是将Example改名为Criteria 当然 想改成什么都行~
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$" />
<property name="replaceString" value="Criteria" />
</plugin>
-->
<plugin
type="org.mybatis.generator.plugins.EqualsHashCodePlugin" />
<plugin
type="org.mybatis.generator.plugins.MapperConfigPlugin">
<property name="fileName" value="GeneratedMapperConfig.xml" />
<property name="targetPackage"
value="com.cy.mybatis.mbg.util" />
<property name="targetProject" value="${targetProject}" />
</plugin>
<commentGenerator>
<!-- 去除自动生成的注释 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="${driverClass}"
connectionURL="${connectionURL}" userId="${userId}"
password="${password}">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetProject:自动生成代码的位置 -->
<javaModelGenerator targetPackage="${modelPackage}"
targetProject="${targetProject}">
<property name="enableSubPackages" value="true" />
</javaModelGenerator>

<sqlMapGenerator targetPackage="${sqlMapperPackage}"
targetProject="${targetProject}">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>

<javaClientGenerator type="XMLMAPPER"
targetPackage="${daoMapperPackage}"
targetProject="${targetProject}">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<!--
<table tableName="visitor_info" domainObjectName="Visitor" enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">

</table>
-->
<table tableName="weather_info" domainObjectName="Weather">
</table>
</context>
</generatorConfiguration>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值