美文网首页
springboot入门(3)mybatis工具生成文件

springboot入门(3)mybatis工具生成文件

作者: 一凡的学习笔记 | 来源:发表于2018-08-14 11:22 被阅读0次

1、解压附件压缩包,目录结构:

image.png

2、修改配置文件 genetatorConfig.xml


<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE generatorConfiguration PUBLIC "-//[mybatis.org//DTD](http://mybatis.org//DTD) MyBatis Generator Configuration 1.0//EN" "[http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd](http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd)" >

<generatorConfiguration>

<classPathEntry    location="mysql-connector-java-5.1.35.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://127.0.0.1:3306/devops](mysql://127.0.0.1:3306/devops)" userId="root" password="root">

        </jdbcConnection>

        <javaTypeResolver>

             <property name="forceBigDecimals" value="false"/>

        </javaTypeResolver>

        <javaModelGenerator targetPackage="com.example.demo.domain" targetProject="src">

             <property name="enableSubPackages" value="true"/>

             <property name="trimStrings" value="true"/>

        </javaModelGenerator>

        <sqlMapGenerator targetPackage="com.example.demo.mapping" targetProject="src">

             <property name="enableSubPackages" value="true"/>

         </sqlMapGenerator>

         <javaClientGenerator type="XMLMAPPER" targetPackage="com.example.demo.dao" targetProject="src">

             <property name="enableSubPackages" value="true"/>

         </javaClientGenerator>

        <table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>

    </context>

</generatorConfiguration>

3、执行命令 :java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml,相应的文件自动生成在src目录下

4、可以看到生成的这几个文件夹

image.png

5、将相应的文件放到你的项目的指定位置

附件:

(file://C:\Users\even1\AppData\Local\Temp\enhtmlclip\mybatis-generator-core-1.3.2.rar)

相关文章

网友评论

      本文标题:springboot入门(3)mybatis工具生成文件

      本文链接:https://www.haomeiwen.com/subject/wabmbftx.html