• mybatis之逆向生成的配置文件


    记录一下常用的mybatis逆向生成配置文件,如下:

    <?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>
        <!--mysql 连接数据库驱动jar 这里选择自己本地位置 -->
        <classPathEntry location="D:mysql-connector-java-8.0.15.jar" />
        <context id="ebizRewardCenterMysqlTables" targetRuntime="MyBatis3">
    
            <!-- 控制注释 -->
            <commentGenerator>
                <!-- 是否去除所有自动生成的注释文件 -->
                <property name="suppressAllComments" value="true" />
                <!-- 是否去除所有自动生成的文件的时间戳,默认为false -->
                <property name="suppressDate" value="true" />
            </commentGenerator>
    
            <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
            <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                connectionURL="jdbc:mysql://localhost:3306/ebiz_insurance?useUnicode=true&amp;characterEncoding=utf-8&amp;allowMultiQueries=true"
                userId="root" password="*****">
                <!--设置可以获取tables remarks信息 -->
                <property name="useInformationSchema" value="true" />
                <!--设置可以获取remarks信息 -->
                <property name="remarks" value="true" />
            </jdbcConnection>
    
            <javaModelGenerator targetPackage="com.ebiz.claim.center.model" targetProject="src/main/java" />
    
            <!-- 生成映射文件的包名和位置-->
            <sqlMapGenerator targetPackage="mybatis.generated" targetProject="src/main/resources" />
    
            <javaClientGenerator targetPackage="com.ebiz.claim.center.dao" targetProject="src/main/java" type="XMLMAPPER">
                <!--<property name="enableSubPackages" value="true"/>-->
               <!-- rootInterface 属性可以使得生成的Dao自动继承BaseMybatisDAO接口-->
                <property name="rootInterface" value="com.ebiz.claim.center.common.base.BaseMybatisDAO" />
            </javaClientGenerator>
    
    
            <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是dao层名-->
            <table tableName="ebiz_channel_api" mapperName="EbizChannelApiDAO"
                           domainObjectName="EbizChannelApi">
                         <!--主键映射,可以忽略-->
            <generatedKey column="id" sqlStatement="JDBC" identity="true"></generatedKey>
            <!--数据库字段与实体类字段进行映射    javaType实体类中  jdbcType数据库中字段---->
            <!--字段映射规则见字段映射文档-->
            <columnOverride column="req_template" javaType="java.lang.String" jdbcType="VARCHAR"/>
            </table>
    
        </context>
    </generatorConfiguration>
  • 相关阅读:
    .NET设计模式外观模式(Façade Pattern)
    .NET设计模式创建型模式专题总结(Creational Pattern)
    MFC深入浅出消息映射的实现
    .NET设计模式代理模式(Proxy Pattern)
    .NET设计模式工厂方法模式(Factory Method)
    Web Services Security (转)
    MYSQL数据库的查询优化技术
    U盘插入拔出提示
    SQL存储过程(ASP.NET)
    在SQL Server中使用种子表生成流水号注意顺序
  • 原文地址:https://www.cnblogs.com/jiushixihuandaqingtian/p/11212479.html
Copyright © 2020-2023  润新知