使用mybatis-plus-generator进行代码自动生成
Posted 南墙
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用mybatis-plus-generator进行代码自动生成相关的知识,希望对你有一定的参考价值。
为了解放程序员的双手,减少重复性代码的编写,推荐使用插件:mybatis-plus-generator 进行代码自动生成。下面我将详细介绍通过 mybatis-plus-generator 插件自动生成 controller、service、mapper、serviceImpl相关代码。
项目工程目录总览如下:
1. 使用 idea 创建 maven 项目,引入相关依赖,项目pom文件如下所示:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.miaoying.generator</groupId> <artifactId>generator-demo</artifactId> <version>1.0-SNAPSHOT</version> <properties> <mybatis-plus.version>3.0.1</mybatis-plus.version> <mysql.connector.java.version>8.0.19</mysql.connector.java.version> <springfox-swagger.version>2.9.2</springfox-swagger.version> </properties> <dependencies> <!-- mybatisPlus 核心库 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- 提供mysql驱动 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.connector.java.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>RELEASE</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>RELEASE</version> <scope>compile</scope> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${springfox-swagger.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${springfox-swagger.version}</version> </dependency> </dependencies> </project>
2. 在资源文件夹里新增6个文件:
2.1. controller.java.vm
package ${package.Controller}; import org.springframework.web.bind.annotation.RequestMapping; #if(${restControllerStyle}) import org.springframework.web.bind.annotation.RestController; #else import org.springframework.stereotype.Controller; #end #if(${superControllerClassPackage}) import ${superControllerClassPackage}; #end /** * @auther ${author} * @create ${cfg.dateTime} * @describe $!{table.comment}前端控制器 */ #if(${restControllerStyle}) @RestController #else @Controller #end @RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end") #if(${kotlin}) class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end #else #if(${superControllerClass}) public class ${table.controllerName} extends ${superControllerClass} { #else public class ${table.controllerName} { #end } #end
2.2. entity.java.vm
package ${package.Entity}; #foreach($pkg in ${table.importPackages}) import ${pkg}; #end import com.baomidou.mybatisplus.annotation.*; #if(${swagger2}) import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonInclude; #end #if(${entityLombokModel}) import lombok.Data; #end /** * @auther ${author} * @create ${cfg.dateTime} * @describe $!{table.comment}实体类 */ #if(${entityLombokModel}) @Data #end @TableName("${table.name}") #if(${swagger2}) @JsonInclude(JsonInclude.Include.NON_NULL) @ApiModel(value="${entity}对象", description="$!{table.comment}") #end #if(${superEntityClass}) public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end { #elseif(${activeRecord}) public class ${entity} extends Model<${entity}> { #else public class ${entity} implements Serializable { #end private static final long serialVersionUID = 1L; ## ---------- BEGIN 字段循环遍历 ---------- #foreach($field in ${table.fields}) #if(${field.keyFlag}) #set($keyPropertyName=${field.propertyName}) #end #if("$!field.comment" != "") #if(${swagger2}) @ApiModelProperty(value = "${field.comment}") #else /** * ${field.comment} */ #end #end #if(${field.keyFlag}) ## 主键 #if(${field.keyIdentityFlag}) @TableId(value = "${field.name}", type = IdType.AUTO) #elseif(!$null.isNull(${idType}) && "$!idType" != "") @TableId(value = "${field.name}", type = IdType.${idType}) #elseif(${field.convert}) @TableId("${field.name}") #end ## 普通字段 #elseif(${field.fill}) ## ----- 存在字段填充设置 ----- #if(${field.convert}) @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) #else @TableField(fill = FieldFill.${field.fill}) #end #else @TableField("${field.name}") #end ## 乐观锁注解 #if(${versionFieldName}==${field.name}) @Version #end ## 逻辑删除注解 #if(${logicDeleteFieldName}==${field.name}) @TableLogic #end private ${field.propertyType} ${field.propertyName}; #end ## ---------- END 字段循环遍历 ---------- #if(!${entityLombokModel}) #foreach($field in ${table.fields}) #if(${field.propertyType.equals("boolean")}) #set($getprefix="is") #else #set($getprefix="get") #end public ${field.propertyType} ${getprefix}${field.capitalName}() { return ${field.propertyName}; } #if(${entityBuilderModel}) public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { #else public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { #end this.${field.propertyName} = ${field.propertyName}; #if(${entityBuilderModel}) return this; #end } #end #end #if(${entityColumnConstant}) #foreach($field in ${table.fields}) public static final String ${field.name.toUpperCase()} = "${field.name}"; #end #end #if(${activeRecord}) @Override protected Serializable pkVal() { #if(${keyPropertyName}) return this.${keyPropertyName}; #else return null; #end } #end #if(!${entityLombokModel}) @Override public String toString() { return "${entity}{" + #foreach($field in ${table.fields}) #if($!{foreach.index}==0) "${field.propertyName}=" + ${field.propertyName} + #else ", ${field.propertyName}=" + ${field.propertyName} + #end #end "}"; } #end }
2.3. mapper.java.vm
package ${package.Mapper}; import ${package.Entity}.${entity}; import ${superMapperClassPackage}; /** * @auther ${author} * @create ${cfg.dateTime} * @describe $!{table.comment}mapper类 */ #if(${kotlin}) interface ${table.mapperName} : ${superMapperClass}<${entity}> #else public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { } #end
2.4. mapper.xml.vm
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="${package.Mapper}.${table.mapperName}"> #if(${enableCache}) <!-- 开启二级缓存 --> <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> #end #if(${baseResultMap}) <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="${package.Entity}.${entity}"> #foreach($field in ${table.fields}) #if(${field.keyFlag})##生成主键排在第一位 <id column="${field.name}" property="${field.propertyName}" /> #end #end #foreach($field in ${table.commonFields})##生成公共字段 <result column="${field.name}" property="${field.propertyName}" /> #end #foreach($field in ${table.fields}) #if(!${field.keyFlag})##生成普通字段 <result column="${field.name}" property="${field.propertyName}" /> #end #end </resultMap> #end #if(${baseColumnList}) <!-- 通用查询结果列 --> <sql id="Base_Column_List"> #foreach($field in ${table.commonFields}) ${field.name}, #end ${table.fieldNames} </sql> #end </mapper>
2.5. service.java.vm
package ${package.Service}; import ${package.Entity}.${entity}; import ${superServiceClassPackage}; /** * @auther ${author} * @create ${cfg.dateTime} * @describe $!{table.comment}服务类 */ #if(${kotlin}) interface ${table.serviceName} : ${superServiceClass}<${entity}> #else public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { } #end
2.6. serviceImpl.java.vm
package ${package.ServiceImpl}; import ${package.Entity}.${entity}; import ${package.Mapper}.${table.mapperName}; import ${package.Service}.${table.serviceName}; import ${superServiceImplClassPackage}; import org.springframework.stereotype.Service; /** * @auther ${author} * @create ${cfg.dateTime} * @describe $!{table.comment}服务实现类 */ @Service #if(${kotlin}) open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { } #else public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { } #end
3. 核心类 CodeGenerator.java 内容如下:
package com.miaoying.generator.start; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import com.sun.javafx.PlatformUtil; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; public class CodeGenerator { /** * 代码生成位置 */ public static final String PARENT_NAME = "com.miaoying.generator.modulardb"; /** * modular 名字 */ public static final String MODULAR_NAME = ""; /** * 基本路径 */ public static final String SRC_MAIN_JAVA = "src/main/java/"; /** * 作者 */ public static final String AUTHOR = "CodeGenerator"; /** * 是否是 rest 接口 */ private static final boolean REST_CONTROLLER_STYLE = true; public static final String JDBC_MYSQL_URL = "jdbc:mysql://localhost:3306/garbagesort?" + "serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8"; public static final String JDBC_DRIVER_NAME = "com.mysql.cj.jdbc.Driver"; public static final String JDBC_USERNAME = "root"; public static final String JDBC_PASSWORD = "123456"; public static void main(String[] args) { String moduleName = scanner("模块名"); String tableName = scanner("表名"); String tablePrefix = scanner("表前缀(无前缀输入#)").replaceAll("#", ""); autoGenerator(moduleName, tableName, tablePrefix); } public static void autoGenerator(String moduleName, String tableName, String tablePrefix) { new AutoGenerator() .setGlobalConfig(getGlobalConfig()) .setDataSource(getDataSourceConfig()) .setPackageInfo(getPackageConfig(moduleName)) .setStrategy(getStrategyConfig(tableName, tablePrefix)) .setCfg(getInjectionConfig(moduleName)) .setTemplate(getTemplateConfig()) .execute(); } private static String getDateTime() { LocalDateTime localDate = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); return localDate.format(formatter); } private static InjectionConfig getInjectionConfig(final String moduleName) { return new InjectionConfig() { @Override public void initMap() { Map map = new HashMap(); map.put("dateTime", getDateTime()); setMap(map); final String projectPath = System.getProperty("user.dir"); List<FileOutConfig> fileOutConfigList = new ArrayList<FileOutConfig>(); // 自定义配置会被优先输出 fileOutConfigList.add(new FileOutConfig("/templates/mapper.xml.vm") { @Override public String outputFile(TableInfo tableInfo) { // 自定义输出文件名,如果entity设置了前后缀,此次注意xml的名称也会跟着发生变化 return projectPath + "/src/main/resources/mapper/" + moduleName + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; } }); setFileOutConfigList(fileOutConfigList); } }; } private static StrategyConfig getStrategyConfig(String tableName, String tablePrefix) { return new StrategyConfig() .setNaming(NamingStrategy.underline_to_camel) .setColumnNaming(NamingStrategy.underline_to_camel) .setInclude(tableName) .setRestControllerStyle(REST_CONTROLLER_STYLE) .setEntityBuilderModel(true) .setControllerMappingHyphenStyle(true) .entityTableFieldAnnotationEnable(true) .setTablePrefix(tablePrefix + "_"); } private static PackageConfig getPackageConfig(String moduleName) { return new PackageConfig() .setModuleName(moduleName) .setParent(PARENT_NAME) .setService("service") .setServiceImpl("service.impl") .setController("controller") .setEntity("entity"); } private static DataSourceConfig getDataSourceConfig() { return new DataSourceConfig() .setUrl(JDBC_MYSQL_URL) .setDriverName(JDBC_DRIVER_NAME) .setUsername(JDBC_USERNAME) .setPassword(JDBC_PASSWORD); } private static GlobalConfig getGlobalConfig() { String projectPath = System.getProperty("user.dir"); String filePath = projectPath + "/" + MODULAR_NAME + SRC_MAIN_JAVA; if (PlatformUtil.isWindows()) { filePath = filePath.replaceAll("/+|\\\\\\\\+", "\\\\\\\\"); } else { filePath = filePath.replaceAll("/+|\\\\\\\\+", "/"); } return new GlobalConfig() .setOutputDir(filePath) .setDateType(DateType.ONLY_DATE) .setIdType(IdType.UUID) .setAuthor(AUTHOR) .setBaseColumnList(true) .setSwagger2(true) .setEnableCache(false) .setBaseResultMap(true) .setOpen(false); } private static TemplateConfig getTemplateConfig() { return new TemplateConfig() .setController("/templates-generator/controller.java.vm") .setService("/templates-generator/service.java.vm") .setServiceImpl("/templates-generator/serviceImpl.java.vm") .setEntity("/templates-generator/entity.java.vm") .setMapper("/templates-generator/mapper.java.vm") .setXml("/templates-generator/mapper.xml.vm"); } private static String scanner(String tip) { Scanner scanner = new Scanner(System.in); StringBuilder sb = new StringBuilder(); sb.append("please input " + tip + " : "); System.out.println(sb.toString()); if (scanner.hasNext()) { String ipt = scanner.next(); if (StringUtils.isNotEmpty(ipt)) { return ipt; } } throw new MybatisPlusException("please input the correct " + tip + ". "); } }
4. 执行 CodeGenerator.java 里面的 main 方法,根据个人数据库表的配置与期望的工程目录的配置,依次输入模块名、表名、表前缀,比如我的数据库里面有张表叫做: header_click,执行 main 方法时,根据提示依次输入如下:header、header_click、#,最终会在项目工程目录里新增对应的自动生成的文件:
执行 main 方法时,控制台的日志输出如下:
please input 模块名 : header please input 表名 : header_click please input 表前缀(无前缀输入#) : # 13:16:09.416 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================准备生成文件...========================== 13:16:10.321 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [D:\\my-projects\\generator-demo\\src\\main\\java\\com\\miaoying\\generator\\modulardb\\header\\entity] 13:16:10.321 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [D:\\my-projects\\generator-demo\\src\\main\\java\\com\\miaoying\\generator\\modulardb\\header\\controller] 13:16:10.323 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [D:\\my-projects\\generator-demo\\src\\main\\java\\com\\miaoying\\generator\\modulardb\\header\\mapper\\xml] 13:16:10.323 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [D:\\my-projects\\generator-demo\\src\\main\\java\\com\\miaoying\\generator\\modulardb\\header\\service] 13:16:10.323 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [D:\\my-projects\\generator-demo\\src\\main\\java\\com\\miaoying\\generator\\modulardb\\header\\service\\impl] 13:16:10.328 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()... 13:16:10.328 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.0 13:16:10.331 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties 13:16:10.352 [main] DEBUG org.apache.velocity - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 13:16:10.353 [main] DEBUG org.apache.velocity - initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) with class java.util.Collections$SynchronizedMap cache map. 13:16:10.355 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Stop 13:16:10.355 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Define 13:16:10.356 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Break 13:16:10.356 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Evaluate 13:16:10.357 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Macro 13:16:10.358 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Parse 13:16:10.359 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Include 13:16:10.359 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach 13:16:10.373 [main] DEBUG org.apache.velocity.parser - Created \'20\' parsers. 13:16:10.383 [main] DEBUG org.apache.velocity.macro - "velocimacro.library" is not set. Trying default library: VM_global_library.vm 13:16:10.383 [main] DEBUG org.apache.velocity.loader.file - Could not load resource \'VM_global_library.vm\' from ResourceLoader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 13:16:10.383 [main] DEBUG org.apache.velocity.macro - Default library not found. 13:16:10.383 [main] DEBUG org.apache.velocity.macro - allowInline = true: VMs can be defined inline in templates 13:16:10.383 [main] DEBUG org.apache.velocity.macro - allowInlineToOverride = false: VMs defined inline may NOT replace previous VM definitions 13:16:10.383 [main] DEBUG org.apache.velocity.macro - allowInlineLocal = false: VMs defined inline will be global in scope if allowed. 13:16:10.383 [main] DEBUG org.apache.velocity.macro - autoload off: VM system will not automatically reload global library macros 13:16:10.394 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/mapper.xml.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 13:16:10.396 [main] DEBUG org.apache.velocity.rendering - ================================================================= 13:16:10.396 [main] DEBUG org.apache.velocity.rendering - == Class: class java.util.HashMap 13:16:10.397 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.util.HashMap 13:16:10.399 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.remove(java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.remove(java.lang.Object,java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.get(java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.put(java.lang.Object,java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Collection java.util.HashMap.values() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.clone() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.clear() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.isEmpty() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.replace(java.lang.Object,java.lang.Object,java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.replace(java.lang.Object,java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.replaceAll(java.util.function.BiFunction) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public int java.util.HashMap.size() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Set java.util.HashMap.entrySet() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.putAll(java.util.Map) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.putIfAbsent(java.lang.Object,java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Set java.util.HashMap.keySet() 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.compute(java.lang.Object,java.util.function.BiFunction) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.computeIfAbsent(java.lang.Object,java.util.function.Function) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.computeIfPresent(java.lang.Object,java.util.function.BiFunction) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.containsKey(java.lang.Object) 13:16:10.400 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.containsValue(java.lang.Object) 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.forEach(java.util.function.BiConsumer) 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.getOrDefault(java.lang.Object,java.lang.Object) 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.merge(java.lang.Object,java.lang.Object,java.util.function.BiFunction) 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.util.Map 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Adding public abstract boolean java.util.Map.equals(java.lang.Object) 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Adding public abstract int java.util.Map.hashCode() 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.lang.Cloneable 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.io.Serializable 13:16:10.401 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.util.AbstractMap 13:16:10.401以上是关于使用mybatis-plus-generator进行代码自动生成的主要内容,如果未能解决你的问题,请参考以下文章
springboot+mybatis-plus-generator3.5.1代码生产