MBG逆向工程

mybatis generator - 逆向工程

1. pom.xml



    4.0.0

    com.winton
    winton-MBG
    1.0-SNAPSHOT

    
        UTF-8
        ${basedir}/src/main/java
        com.winton.mapper
        com.winton.model
        
        ${basedir}/src/main/resources
        mapper
        
        3.4.6
        5.1.29
    


    
        
            junit
            junit
            3.8.1
            test
        
        
            tk.mybatis
            mapper
            ${mapper.version}
        
        
        
            org.mybatis.generator
            mybatis-generator-core
            1.3.2
        

    


    
        
            
                org.mybatis.generator
                mybatis-generator-maven-plugin
                1.3.2
                
                    ${basedir}/src/main/resources/generator/generatorConfig.xml
                    true
                    true
                
                
                    
                        mysql
                        mysql-connector-java
                        ${mysql.version}
                    
                    
                        tk.mybatis
                        mapper
                        ${mapper.version}
                    
                
            
        
    



2. generatorConfig.xml

/generator/generatorConfig.xml 注意要与pom文件中的包一致





    

    
        
        


        
        

        
            
            
        

        
      

        
        

        

        

        

        
        

3. config.properties

# 数据库配置
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/pinyougou
jdbc.user=root
jdbc.password=root

# 通用Mapper配置
mapper.plugin=tk.mybatis.mapper.generator.MapperPlugin

mapper.Mapper=tk.mybatis.mapper.common.Mapper

mapper.forceAnnotation=true

4. 运行maven命令

mybatis-generator:generate  //运行就生成完毕

ps: Free Mybatis plugin

mapper接口和xml切换的插件

你可能感兴趣的:(MBG逆向工程)