Mybatis 使用maven插件mybatis-generator自动生成entities和SQL和mapper

Posted 注销了

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mybatis 使用maven插件mybatis-generator自动生成entities和SQL和mapper相关的知识,希望对你有一定的参考价值。

先安装插件

 

再写配置文件

<?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:/Users/Ash/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar"/>
    <context id="productRelease">
        <property name="mergeable" value="false" />
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
            connectionURL="jdbc:mysql://localhost:3306/springbankdb"
            userId="a" password="a" />
        <javaModelGenerator targetPackage="com.springbank.dao.generate.model"
            targetProject="springbank-dao" />
        <sqlMapGenerator targetPackage="com.springbank.dao.generate.mapper"
            targetProject="springbank-dao" />
        
        <javaClientGenerator targetPackage="com.springbank.dao.generate.mapper"
            targetProject="springbank-dao" type="XMLMAPPER" />
        <table tableName="owner" />
        <table tableName="acctrate" />
        <table tableName="acct" />
        <table tableName="acctstatus" />
        <table tableName="sysparam" />
        <table tableName="rtxn" />
        <table tableName="rate" />
        <table tableName="ratetype" />
        <table tableName="prod" />
        <table tableName="rtxntypgl" />
        <!-- <table tableName="scheduledjob" /> -->
    </context>
</generatorConfiguration>

 

以上是关于Mybatis 使用maven插件mybatis-generator自动生成entities和SQL和mapper的主要内容,如果未能解决你的问题,请参考以下文章

如何在IntelliJ IDEA上 添加GIT和Maven,mybatis插件

Mybatis-Generator插件的使用与Spring集成Mybatis的配置

Maven插件方式使用Mybatis Generator

Mybatis 使用maven插件mybatis-generator自动生成entities和SQL和mapper

用Maven插件生成Mybatis代码

mybatis源码学习利用maven插件自动生成mybatis代码