eclipse 安装mybatis generater,在网上找的帖子,感觉都太麻烦,下这个下那个,要这个要那个的,不如用
eclipse Marketplace 直接下载安装,下面是步骤
1,打开eclipse Marketplace
2,搜索mybatis generater,然后下载,等待安装后重启
3,右击generatorConfig.xml文件,点击Run As/Debug As,在点击 Run Mybatis Generater即可
4,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="C:\D\Program Files (x86)\Maven\maven-repository\mysql\mysql-connector-java\5.1.35\mysql-connector-java-5.1.35.jar" />
<context id="sqlserverTables" targetRuntime="MyBatis3">
<!-- 生成的pojo,将implements Serializable -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!-- 数据库链接URL、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/gam" userId="root" password="123">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成model模型,对应的包路径,以及文件存放路径(targetProject),targetProject可以指定具体的路径,如./src/main/java,
也可以使用“MAVEN”来自动生成,这样生成的代码会在target/generatord-source目录下 -->
<!--<javaModelGenerator targetPackage="com.joey.mybaties.test.pojo" targetProject="MAVEN"> -->
<javaModelGenerator targetPackage="com.ssm.modules.user.entity" targetProject="shejiaoappserver/src/main/java">
<property name="enableSubPackages" value="true" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!--对应的mapper.xml文件 -->
<sqlMapGenerator targetPackage="com.ssm.modules.user.mapper" targetProject="shejiaoappserver/src/main/java">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 对应的Mapper接口类文件-->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.ssm.modules.user.dao" targetProject="shejiaoappserver/src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 列出要生成代码的所有表,这里配置的是不生成Example文件 -->
<table tableName="tf_direct_selling_brand" domainObjectName="TfDirectSellingBrand"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<property name="useActualColumnNames" value="false" />
</table>
</context>
</generatorConfiguration>