<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.1</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>3.5.2</version> </dependency> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> <version>2.0</version> </dependency> <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.31</version> </dependency>
package com.test.db; import com.baomidou.mybatisplus.generator.FastAutoGenerator; public class TestGenCode { public static void main(String[] args) { FastAutoGenerator.create("jdbc:mysql://localhost:3306/test_db?useSSL=false&autoReconnect=true&characterEncoding=utf8", "root", "123456") .globalConfig(builder -> builder.author("xxx") // 设置作者 .enableSwagger() // 开启 swagger 模式 ) .packageConfig(builder -> builder.parent("com.test.db") // 设置父包名 .moduleName("gencode") // 设置父包模块名 ) .strategyConfig(builder -> builder.addInclude("tb_user", "tb_role", "tb_user_role") ) .execute(); } }
标签:mybatisplus,tb,代码,生成,baomidou,mysql,com,builder From: https://www.cnblogs.com/goPush/p/16975963.html