zoukankan      html  css  js  c++  java
  • mybatis generator

    pom.xml

     

    <dependency>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-core</artifactId>
    <version>1.3.5</version>
    </dependency>
    <plugin>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-maven-plugin</artifactId>
    <version>1.3.5</version>
    <configuration>
    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
    <verbose>true</verbose>
    <overwrite>false</overwrite>
    </configuration>
    <executions>
    <execution>
    <id>Generate MyBatis Artifacts</id>
    <phase>deploy</phase><!--避免每次install都生成代码-->
    <goals>
    <goal>generate</goal>
    </goals>
    </execution>
    </executions>
    <dependencies>
    <dependency>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-core</artifactId>
    <version>1.3.5</version>
    </dependency>
    </dependencies>
    </plugin>


    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="D: espmysqlmysql-connector-java5.1.46mysql-connector-java-5.1.46.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://rm-bp1v9sh87u647cdv1ro.mysql.rds.aliyuncs.com:3306/myblog" userId="root" password="lml0706">
    </jdbcConnection>
    <javaTypeResolver>
    <property name="forceBigDecimals" value="false"/>
    </javaTypeResolver>
    <!--生成Model类存放位置-->
    <javaModelGenerator targetPackage="com.lml.myblog.entity" targetProject="src/main/java">
    <property name="enableSubPackages" value="true"/>
    <property name="trimStrings" value="true"/>
    </javaModelGenerator>
    <!--生成映射文件存放位置-->
    <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
    <property name="enableSubPackages" value="true"/>
    </sqlMapGenerator>
    <!--生成Dao类存放位置-->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.lml.myblog.dao" targetProject="src/main/java">
    <property name="enableSubPackages" value="true"/>
    </javaClientGenerator>
    <!--生成对应表及类名-->
    <table tableName="article" domainObjectName="Article" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
    <table tableName="type" domainObjectName="Type" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
    </context>
    </generatorConfiguration>



  • 相关阅读:
    I.MX6 Parallel RGB LCD Datasheet描述
    ubuntu IP 扫描
    I.MX6 按键开关机 PMIC 检测
    java中对List中对象排序实现
    jQuery实现父窗口的问题
    如何在Oracle中复制表结构和表数据
    handsontable常规配置的中文API
    oracle中to_date详细用法示例(oracle日期格式转换)
    js中子页面父页面方法和变量相互调用
    关于Ajax的type为post提交方式出现请求失效问题
  • 原文地址:https://www.cnblogs.com/myDreamWillCometrue/p/9122733.html
Copyright © 2011-2022 走看看