zoukankan      html  css  js  c++  java
  • mybatis逆向工程generatorConfiguration详细配置

    <?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>
    
    
        <!-- 指定数据连接驱动jar地址 -->
        <classPathEntry
            location="C:/m2/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar" />
    
        <!-- 一个数据库一个context -->
        <context id="context">
            <!-- 注释 -->
            <commentGenerator>
                <property name="suppressAllComments" value="true" /><!-- 是否取消注释 -->
                <property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳 -->
            </commentGenerator>
    
            <!-- jdbc连接 -->
            <jdbcConnection
                connectionURL=""
                driverClass="com.mysql.jdbc.Driver" password=""
                userId="" />
    
            <!-- 类型转换 -->
            <javaTypeResolver>
                <!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
                <property name="forceBigDecimals" value="false" />
            </javaTypeResolver>
    
            <!-- 生成实体类的包名和位置 注意targetProject的值为实体类放在工程中具体位置的相对路径, -->
            <javaModelGenerator targetPackage="com.alipayeco.medicalinscore.dal.entity"
                targetProject="mybatis-generator-tool\srcmainjava">
                <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
                <property name="enableSubPackages" value="true" />
                <!-- 是否针对string类型的字段在set的时候进行trim调用 -->
                <property name="trimStrings" value="true" />
            </javaModelGenerator>
    
            <!-- 生成的SQLMapper映射文件包名和位置 -->
            <sqlMapGenerator targetPackage="com.alipayeco.medicalinscore.dal.mapper"
                targetProject="mybatis-generator-tool\srcmain
    esources">
                <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
                <property name="enableSubPackages" value="true" />
            </sqlMapGenerator>
    
            <!-- 生成DAO的包名和位置,这里配置将生成的dao类放在me.gacl.dao这个包下 -->
            <javaClientGenerator targetPackage="com.alipayeco.medicalinscore.dal.mapper"
                targetProject="mybatis-generator-tool\srcmainjava" type="XMLMAPPER">
                <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
                <property name="enableSubPackages" value="true" />
            </javaClientGenerator>
    
            <!-- 配置表信息 -->
            <!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample 
                是否生成 example类 -->
            <!-- 更改tableName和domainObjectName就可以 -->
            <table schema="bridge-db-test" tableName="account_si_income_info" mapperName="AccountSiIncomeInfoMapper" 
                domainObjectName="AccountSiIncomeInfoDO"  enableCountByExample="false"
                enableUpdateByExample="false" enableDeleteByExample="false"
                enableSelectByExample="false" selectByExampleQueryId="false">
                <!-- 下面子属性是保持数据库与实体类字段名一致性 -->
                <property name="useActualColumnNames" value="true"/>
            </table>
        </context>
    </generatorConfiguration> 

     注: jdbcType为tinyint类型转换成javaType会变成byte类型

  • 相关阅读:
    数据库信息 (表名 行数 堆 集群 非聚集)的查询
    jquerygalleryview2.0 漂亮多样化的图片特效(多项自定义)
    枚举 EnumDescription 位运算 权限 sql c#
    vs2010缓存类
    透明遮罩层
    app_offline.htm的作用
    XmlToJSON(c#)
    jquery性能最佳实践
    .net面试问答(大汇总)
    apk反编译
  • 原文地址:https://www.cnblogs.com/zyf-yxm/p/10495004.html
Copyright © 2011-2022 走看看