generator-mybaties

第一步 porm 文件引入插件

org.mybatis.generator

mybatis-generator-maven-plugin

${mybatis.generator.version}

true

mysql

mysql-connector-java

${mysql.version}

第二步:根目录下导入两个配置文件

(1)generatorConfig.xml

        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"

        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

defaultModelType="flat">

value="org.mybatis.generator.api.dom.DefaultJavaFormatter" />

value="org.mybatis.generator.api.dom.DefaultXmlFormatter" />

connectionURL="${jdbc_url}" userId="${jdbc_user}" password="${jdbc_password}" />

targetProject="${project}">

targetProject="${resources}">

targetProject="${project}" type="XMLMAPPER">

enableUpdateByPrimaryKey="true" enableDeleteByExample="true"

enableDeleteByPrimaryKey="true" enableUpdateByExample="true"

enableCountByExample="true" enableSelectByExample="true"

selectByExampleQueryId="true">

(2)mybatisGeneratorinit.properties:

#Mybatis Generator configuration

#dao and entity location

project=src/main/java

#mapper location

resources=src/main/resources

jdbc_driver=com.mysql.jdbc.Driver

jdbc_url=jdbc:mysql://localhost:3306/ta

jdbc_user=buyside

jdbc_password=buyside

第三步

执行命令:mybatis-generator:generate

你可能感兴趣的:(generator-mybaties)