SpringBoot使用mybatis-generator

我使用的开发工具时idea

pom文件:


    
        
            org.mybatis.generator
            mybatis-generator-maven-plugin
            1.3.6
            
                
                    mybatis-generator/generatorConfig.xml
                
                true
                true
            
            
                
                    mysql
                    mysql-connector-java
                    5.1.44
                
                
                    com.itfsw
                    mybatis-generator-plugin
                    1.1.2
                
            
        
    

项目目录:


generatorConfig.xml中:

xml version="1.0" encoding="UTF-8"?>
generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">



   id="mysqlgenerator" targetRuntime="MyBatis3">
      name="autoDelimitKeywords" value="true" />
      
      name="beginningDelimiter" value="`" />
      name="endingDelimiter" value="`" />

      
      type="org.mybatis.generator.plugins.ToStringPlugin" />
      
      type="org.mybatis.generator.plugins.EqualsHashCodePlugin" />

      
      
      type="com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin" />
      
      type="com.itfsw.mybatis.generator.plugins.SelectSelectivePlugin" />
      
      type="com.itfsw.mybatis.generator.plugins.ExampleEnhancedPlugin" />
      
      type="com.itfsw.mybatis.generator.plugins.ModelColumnPlugin" />

      
      
         name="suppressDate" value="true"/>
         name="suppressAllComments" value="true"/>
      

      
      driverClass="com.mysql.jdbc.Driver"
         connectionURL="jdbc:mysql://127.0.0.1:3306/heizhu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false"
         userId="root" password="root" />


      targetPackage="com.datbc.pig360.db.domain"
         targetProject="src/main/java" />
      targetPackage="com.datbc.pig360.db.dao"
         targetProject="src/main/resources" />
      type="XMLMAPPER"
         targetPackage="com.datbc.pig360.db.dao" targetProject="src/main/java" />
      
      
      tableName="manager_bc_log">
         column="id" sqlStatement="MySql" identity="true" />
         javaType="java.time.LocalDateTime" column="add_time" />
      

使用步骤:

SpringBoot使用mybatis-generator_第1张图片

SpringBoot使用mybatis-generator_第2张图片

然后每次添加新表后,就可以直接点击这里生成了

SpringBoot使用mybatis-generator_第3张图片

你可能感兴趣的:(java后台)