• Mybatis-Generator demo


    使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)

    https://www.cnblogs.com/smileberry/p/4145872.html

    ===================================================================

     一种改进的方式:把数据和配置分离开来,更优雅

            <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.2</version>
                </plugin>         
    

     

     

    <?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>
    	<properties resource="generator.properties" />
    	<classPathEntry
    		location="${maven.repo}mysqlmysql-connector-java${jdbc.driver.version}mysql-connector-java-${jdbc.driver.version}.jar" />
    
    	<context id="MySQL" targetRuntime="MyBatis3" defaultModelType="flat">
    		<property name="beginningDelimiter" value="`" />
    		<property name="endingDelimiter" value="`" />
    
    		<commentGenerator>
    			<property name="suppressAllComments" value="true" />
    			<property name="suppressDate" value="true" />
    		</commentGenerator>
    
    		<jdbcConnection driverClass="${jdbc.driver.class}"
    			connectionURL="${jdbc.connection.url}" userId="${jdbc.userId}"
    			password="${jdbc.password}">
    		</jdbcConnection>
    
    		<javaTypeResolver>
    			<property name="forceBigDecimals" value="false" />
    		</javaTypeResolver>
    
    		<javaModelGenerator targetPackage="${model.targetPackage}"
    			targetProject="src/main/java">
    			<property name="enableSubPackages" value="true" />
    			<property name="trimStrings" value="true" />
    		</javaModelGenerator>
    
    		<sqlMapGenerator targetPackage="${sqlmap.targetPackage}"
    			targetProject="src/main/resources">
    			<property name="enableSubPackages" value="true" />
    		</sqlMapGenerator>
    
    		<javaClientGenerator type="XMLMAPPER"
    			targetPackage="${client.targetPackage}" targetProject="src/main/java">
    			<property name="enableSubPackages" value="true" />
    		</javaClientGenerator>
    
    		<table tableName="tb_zxx_demonstration_period" domainObjectName="DemonstrationPeriod"
    			   enableCountByExample="false" enableUpdateByExample="false"
    			   enableDeleteByExample="false" enableSelectByExample="false"
    			   selectByExampleQueryId="false">
    		</table>
    		
    	</context>
    </generatorConfiguration>  
    

      

    #maven.repo=D:\workshop\repo
    #maven.repo=C:\Users\yzy\.m2\repository
    maven.repo=C:\Users\Administrator\.m2\repository
    
    
    #jdbcu9A71u52A8u7C7Bu540D
    jdbc.driver.class=com.mysql.jdbc.Driver
    
    #jdbcu9A71u52A8u7248u672C
    jdbc.driver.version=5.1.26
    
    
    jdbc.connection.url=jdbc:mysql://127.0.0.1:23306/test?useUnicode=true&characterEncoding=UTF-8
    
    
    #jdbcu8FDEu63A5u7528u6237u540D
    jdbc.userId=root
    
    #jdbcu8FDEu63A5u5BC6u7801
    jdbc.password=root
    
    #u9879u76EEu6E90u7801u8DEFu5F84
    targetProject=src/main/resources
    
    #modelu5305u8DEFu5F84
    model.targetPackage=com.baidu.qqhy.zxx.entity
    
    client.targetPackage=com.baidu.qqhy.zxx.mapper
    
    sqlmap.targetPackage=mapper
    

      

  • 相关阅读:
    异或运算实现两数交换
    安装Keepalived namespaces.c:187: error: ‘SYS_setns’ undeclared (first use in this function)
    安装keepalived OpenSSL is not properly installed on your system. !!!
    jackson json转实体对象 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException
    solr集群Server refused connection at: http://127.0.0.1:6060/solr/ego 注册zookeepr自动使用内网ip
    Solr java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQL server
    Jackson中@JsonProperty等常用注解
    java.lang.ClassNotFoundException: XXX (no security manager: RMI class loader disabled)
    ActiveMQ学习总结------Spring整合ActiveMQ 04
    为什么嵌入式开发用memcpy()而不用strncpy()
  • 原文地址:https://www.cnblogs.com/whoknows1/p/11057547.html
Copyright © 2020-2023  润新知