亲宝软件园·资讯

展开

Java实现MybatisPlus代码生成器 Java实战之实现一个好用的MybatisPlus代码生成器

東辰 人气:0
想了解Java实战之实现一个好用的MybatisPlus代码生成器的相关内容吗,東辰在本文为您仔细讲解Java实现MybatisPlus代码生成器的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Java,MybatisPlus代码生成器,java代码生成器,下面大家一起来学习吧。

一、先看下项目结构

CodeGenerator:生成器主类

resources下的mapper.java.vm:一个模板类,用以在生成dao层时按模板来生成代码

在这里插入图片描述

比如我们想把代码按如下目录来生成:

代码层 代码生成位置
Controller层 com.yinchd.web.controller
Service层 com.yinchd.web.service
Service实现类 com.yinchd.web.service
implMapper层 com.yinchd.web.mapper
xml文件 com.yinchd.web.mapper.xml
Model层 com.yinchd.web.model

二、先引入MybatisPlus及Generator相关的依赖

项目是SpringBoot项目,我略去了其它依赖,只保留了MybatisPlus及Generator相关的依赖

<properties>
	<mybatis-plus.version>3.4.2</mybatis-plus.version>
	<mybatis-plus-generator.version>3.4.1</mybatis-plus-generator.version>
	<velocity-engine-core.version>2.0</velocity-engine-core.version>
</properties>
<!-- Mybatis-Plus-->
<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-extension</artifactId>
    <version>${mybatis-plus.version}</version>
</dependency>
<!-- Mybatis-Plus-Generator -->
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-generator</artifactId>
    <version>${mybatis-plus-generator.version}</version>
</dependency>
<!-- 模板引擎(Mybatis-Plus-Generator会用到) -->
<dependency>
    <groupId>org.apache.velocity</groupId>
    <artifactId>velocity-engine-core</artifactId>
    <version>${velocity-engine-core.version}</version>
</dependency>

三、具体代码

3.1 mapper.java.vm

这里主要就是解决dao层生成时没有加@Mapper注解的这个问题

所以这个文件里,我主要加了一个@Mapper注解,加了import org.apache.ibatis.annotations.Mapper;这一行,其它代码都是vm文件原始的内容

package ${package.Mapper};

import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * $!{table.comment} Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
#if(${kotlin})
interface ${table.mapperName} : ${superMapperClass}<${entity}>
#else
@Mapper
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {

}
#end

3.2 CodeGenerator

package com.yinchd.web;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;

/**
 * Mybatis生成器
 *
 * @author yinchd
 * @date 2019 /3/26
 */
public class CodeGenerator {

    /**
     * 当前项目的路径
     */
    static final String PROJECT_PATH = System.getProperty("user.dir");
    /**
     * java文件路径
     */
    static final String CODE_HOME = "/src/main/java";

    /**
     * 代码生成器入口.
     */
    public static void main(String[] args) {
        // 待生成的表名
        String tableName = "sys_role";
        // 生成的时候要去掉的表前缀,如果不需要去除什么前缀,则这里为空就行
        String trimTablePrefix = "sys_";
        // 生成文件的父包路径
        String codeGeneratePath = "com.yinchd.web";
        System.out.println("开始生成如下表:" + tableName + " 到 " + codeGeneratePath + " 目录中...");
        // 后面三个boolean值分别代表是否生成Controller、Service、Dao和实体,有时我们改了表结构,这里可以方便控制生成哪些,不生成哪些
        generate(tableName, trimTablePrefix, codeGeneratePath, true, true, true);
        System.out.println("生成成功...");
    }

    /**
     * 代码生成入口
     * @param tableName 表名
     * @param trimTablePrefix 要去除的表前缀 eg:表名:t_user, 如果不去除`t_`前缀的话,则生成的类名为TUser,如果去掉,则生成的类名为User
     * @param basePkg 生成文件的父包路径
     * @param controller 是否生成controller
     * @param service 是否生成service
     * @param mapper 是否生成mapper
     */
    private static void generate(String tableName, String trimTablePrefix, String basePkg,
            boolean controller, boolean service, boolean mapper) {
        AutoGenerator generator = new AutoGenerator();
        // 全局配置
        generator.setGlobalConfig(getGlobalConfig());
        // 数据源
        generator.setDataSource(getDataSourceConfig());
        // 生成策略
        generator.setStrategy(getStrategyConfig(tableName, trimTablePrefix));
        // 生成模板
        generator.setTemplate(getTemplateConfig(controller, service, mapper));
        // 生成目标信息
        generator.setPackageInfo(getPackageConfig(basePkg));
        // 执行生成
        generator.execute();
    }

    private static PackageConfig getPackageConfig(String basePkg) {
        // 包配置
        PackageConfig packageConfig = new PackageConfig();
        // 父包路径
        packageConfig.setParent(basePkg);
        packageConfig.setController("controller");
        packageConfig.setService("service");
        packageConfig.setServiceImpl("service.impl");
        packageConfig.setMapper("mapper");
        packageConfig.setEntity("model");
        packageConfig.setXml("mapper.xml");
        return packageConfig;
    }

    private static GlobalConfig getGlobalConfig() {
        // 全局配置
        GlobalConfig globalConfig = new GlobalConfig();
        // 生成文件输出根目录
        globalConfig.setOutputDir(PROJECT_PATH + CODE_HOME);
        // 生成完成后不弹出文件框
        globalConfig.setOpen(false);
        // 文件覆盖
        globalConfig.setFileOverride(true);
        // 不需要ActiveRecord特性的请改为false
        globalConfig.setActiveRecord(false);
        // XML 二级缓存
        globalConfig.setEnableCache(false);
        // XML ResultMap
        globalConfig.setBaseResultMap(true);
        // XML columList
        globalConfig.setBaseColumnList(false);
        // 作者
        globalConfig.setAuthor("yinchd");
        globalConfig.setSwagger2(true);

        // 自定义文件命名,注意 %s 会自动填充表实体属性!
        globalConfig.setControllerName("%sController");
        globalConfig.setServiceName("%sService");
        globalConfig.setServiceImplName("%sServiceImpl");
        globalConfig.setMapperName("%sMapper");
        globalConfig.setXmlName("%sMapper");
        globalConfig.setEntityName("%sModel");
        return globalConfig;
    }

    private static TemplateConfig getTemplateConfig(boolean controller, boolean service, boolean mapper) {
        // 解决Mapper.java上没有@Mapper注解的问题
        TemplateConfig templateConfig = new TemplateConfig();
        if (!controller) {
            templateConfig.setController("");
        }
        if (!service) {
            templateConfig.setService("").setServiceImpl("");
        }
        templateConfig.setMapper("/generator/mapper.java.vm");
        if (!mapper) {
            templateConfig.setMapper("").setXml("");
        }
        return templateConfig;
    }

    private static StrategyConfig getStrategyConfig(String tableName, String trimTablePrefix) {
        // 策略配置
        StrategyConfig strategy = new StrategyConfig();

        // 表名生成策略
        strategy.setNaming(NamingStrategy.underline_to_camel);
        strategy.setColumnNaming(NamingStrategy.underline_to_camel);

        // 需要生成的表
        strategy.setInclude(tableName);
        strategy.setSuperServiceClass("com.baomidou.mybatisplus.extension.service.IService");
        strategy.setSuperServiceImplClass("com.baomidou.mybatisplus.extension.service.impl.ServiceImpl");
        strategy.setSuperMapperClass("com.baomidou.mybatisplus.core.mapper.BaseMapper");
        strategy.setEntityLombokModel(true);
        strategy.setRestControllerStyle(true);

        strategy.setControllerMappingHyphenStyle(true);
        strategy.setEntityColumnConstant(true);
        strategy.setEntityBuilderModel(true);
        strategy.setEntityTableFieldAnnotationEnable(true);

        // 去除表前缀
        if (trimTablePrefix != null && !"".equals(trimTablePrefix)) {
            strategy.setTablePrefix(trimTablePrefix);
        }
        // 去除字段前缀
        // strategy.setFieldPrefix("");
        return strategy;
    }

    private static DataSourceConfig getDataSourceConfig() {
        DataSourceConfig dataSourceConfig = new DataSourceConfig();
        // 设置数据库类型
        dataSourceConfig.setDbType(DbType.MYSQL);
        dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver");
        // 指定数据库 master库
        dataSourceConfig.setUrl("jdbc:mysql://ip:3306/db?useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&characterEncoding=utf-8&useSSL=false");
        // 用户名
        dataSourceConfig.setUsername("root");
        // 密码
        dataSourceConfig.setPassword("password");
        return dataSourceConfig;
    }

}

3.3 生成测试

建一张t_test表来测试,表结构如下

CREATE TABLE `t_test` (
  `id` INT (10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id主键',
  `name` VARCHAR (20) NOT NULL COMMENT '名称',
  `sex` CHAR (1) NOT NULL COMMENT '性别',
  `hobby` VARCHAR (100) COMMENT '爱好',
  `mobile` VARCHAR (11) COMMENT '手机号',
  `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) COMMENT = '测试表';

初始化两条数据

INSERT INTO `t_test` (`name`, `sex`, `hobby`, `mobile`) VALUES ('jack', '男', '女', '15888888888'); 
INSERT INTO `t_test` (`name`, `sex`, `hobby`, `mobile`) VALUES ('rose', '女', 'jack', '18888888888'); 

执行CodeGeneratormain方法,来生成对应的代码

public static void main(String[] args) {
    // 待生成的表名
    String tableName = "t_test";
    // 生成的时候要去掉的表前缀,如果不需要去除什么前缀,则这里为空就行
    String trimTablePrefix = "t_";
    // 生成文件的父包路径
    String codeGeneratePath = "com.yinchd.web";
    System.out.println("开始生成如下表:" + tableName + " 到 " + codeGeneratePath + " 目录中...");
    generate(tableName, trimTablePrefix, codeGeneratePath, true, true, true);
    System.out.println("生成成功...");
}

正确执行如下

"C:\Program Files\Java\jdk1.8.0_231\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59499,suspend=y,server=n -javaagent:C:\Users\Administrator\AppData\Local\JetBrains\IntelliJIdea2020.3\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_231\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_231\jre\lib\rt.jar;D:\WorkSpace\myweb-boot\target\classes;D:\Repository\org\springframework\boot\spring-boot-starter\2.4.3\spring-boot-starter-2.4.3.jar;D:\Repository\org\springframework\boot\spring-boot\2.4.3\spring-boot-2.4.3.jar;D:\Repository\org\springframework\boot\spring-boot-autoconfigure\2.4.3\spring-boot-autoconfigure-2.4.3.jar;D:\Repository\org\springframework\boot\spring-boot-starter-logging\2.4.3\spring-boot-starter-logging-2.4.3.jar;D:\Repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\Repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\Repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\Repository\org\springframework\spring-core\5.3.4\spring-core-5.3.4.jar;D:\Repository\org\springframework\spring-jcl\5.3.4\spring-jcl-5.3.4.jar;D:\Repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;D:\Repository\org\springframework\boot\spring-boot-starter-web\2.4.3\spring-boot-starter-web-2.4.3.jar;D:\Repository\org\springframework\boot\spring-boot-starter-json\2.4.3\spring-boot-starter-json-2.4.3.jar;D:\Repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;D:\Repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;D:\Repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;D:\Repository\org\springframework\spring-web\5.3.4\spring-web-5.3.4.jar;D:\Repository\org\springframework\spring-beans\5.3.4\spring-beans-5.3.4.jar;D:\Repository\org\springframework\spring-webmvc\5.3.4\spring-webmvc-5.3.4.jar;D:\Repository\org\springframework\spring-aop\5.3.4\spring-aop-5.3.4.jar;D:\Repository\org\springframework\spring-expression\5.3.4\spring-expression-5.3.4.jar;D:\Repository\org\springframework\boot\spring-boot-starter-undertow\2.4.3\spring-boot-starter-undertow-2.4.3.jar;D:\Repository\io\undertow\undertow-core\2.2.4.Final\undertow-core-2.2.4.Final.jar;D:\Repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;D:\Repository\org\jboss\xnio\xnio-api\3.8.0.Final\xnio-api-3.8.0.Final.jar;D:\Repository\org\wildfly\common\wildfly-common\1.5.2.Final\wildfly-common-1.5.2.Final.jar;D:\Repository\org\wildfly\client\wildfly-client-config\1.0.1.Final\wildfly-client-config-1.0.1.Final.jar;D:\Repository\org\jboss\xnio\xnio-nio\3.8.0.Final\xnio-nio-3.8.0.Final.jar;D:\Repository\org\jboss\threads\jboss-threads\3.1.0.Final\jboss-threads-3.1.0.Final.jar;D:\Repository\io\undertow\undertow-servlet\2.2.4.Final\undertow-servlet-2.2.4.Final.jar;D:\Repository\org\jboss\spec\javax\annotation\jboss-annotations-api_1.3_spec\2.0.1.Final\jboss-annotations-api_1.3_spec-2.0.1.Final.jar;D:\Repository\io\undertow\undertow-websockets-jsr\2.2.4.Final\undertow-websockets-jsr-2.2.4.Final.jar;D:\Repository\org\jboss\spec\javax\websocket\jboss-websocket-api_1.1_spec\2.0.0.Final\jboss-websocket-api_1.1_spec-2.0.0.Final.jar;D:\Repository\jakarta\servlet\jakarta.servlet-api\4.0.4\jakarta.servlet-api-4.0.4.jar;D:\Repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\Repository\net\bytebuddy\byte-buddy\1.10.20\byte-buddy-1.10.20.jar;D:\Repository\org\springframework\boot\spring-boot-configuration-processor\2.4.3\spring-boot-configuration-processor-2.4.3.jar;D:\Repository\com\alibaba\druid-spring-boot-starter\1.2.5\druid-spring-boot-starter-1.2.5.jar;D:\Repository\com\alibaba\druid\1.2.5\druid-1.2.5.jar;D:\Repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\Repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\Repository\mysql\mysql-connector-java\8.0.23\mysql-connector-java-8.0.23.jar;D:\Repository\io\springfox\springfox-boot-starter\3.0.0\springfox-boot-starter-3.0.0.jar;D:\Repository\io\springfox\springfox-oas\3.0.0\springfox-oas-3.0.0.jar;D:\Repository\io\swagger\core\v3\swagger-annotations\2.1.2\swagger-annotations-2.1.2.jar;D:\Repository\io\swagger\core\v3\swagger-models\2.1.2\swagger-models-2.1.2.jar;D:\Repository\io\springfox\springfox-spi\3.0.0\springfox-spi-3.0.0.jar;D:\Repository\io\springfox\springfox-schema\3.0.0\springfox-schema-3.0.0.jar;D:\Repository\io\springfox\springfox-core\3.0.0\springfox-core-3.0.0.jar;D:\Repository\io\springfox\springfox-spring-web\3.0.0\springfox-spring-web-3.0.0.jar;D:\Repository\io\github\classgraph\classgraph\4.8.83\classgraph-4.8.83.jar;D:\Repository\io\springfox\springfox-spring-webmvc\3.0.0\springfox-spring-webmvc-3.0.0.jar;D:\Repository\io\springfox\springfox-spring-webflux\3.0.0\springfox-spring-webflux-3.0.0.jar;D:\Repository\io\springfox\springfox-swagger-common\3.0.0\springfox-swagger-common-3.0.0.jar;D:\Repository\org\mapstruct\mapstruct\1.3.1.Final\mapstruct-1.3.1.Final.jar;D:\Repository\io\springfox\springfox-data-rest\3.0.0\springfox-data-rest-3.0.0.jar;D:\Repository\io\springfox\springfox-bean-validators\3.0.0\springfox-bean-validators-3.0.0.jar;D:\Repository\io\springfox\springfox-swagger2\3.0.0\springfox-swagger2-3.0.0.jar;D:\Repository\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;D:\Repository\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;D:\Repository\io\springfox\springfox-swagger-ui\3.0.0\springfox-swagger-ui-3.0.0.jar;D:\Repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\Repository\org\springframework\plugin\spring-plugin-core\2.0.0.RELEASE\spring-plugin-core-2.0.0.RELEASE.jar;D:\Repository\org\springframework\plugin\spring-plugin-metadata\2.0.0.RELEASE\spring-plugin-metadata-2.0.0.RELEASE.jar;D:\Repository\com\baomidou\mybatis-plus-boot-starter\3.4.2\mybatis-plus-boot-starter-3.4.2.jar;D:\Repository\com\baomidou\mybatis-plus\3.4.2\mybatis-plus-3.4.2.jar;D:\Repository\org\springframework\boot\spring-boot-starter-jdbc\2.4.3\spring-boot-starter-jdbc-2.4.3.jar;D:\Repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;D:\Repository\org\springframework\spring-jdbc\5.3.4\spring-jdbc-5.3.4.jar;D:\Repository\com\baomidou\mybatis-plus-extension\3.4.2\mybatis-plus-extension-3.4.2.jar;D:\Repository\com\baomidou\mybatis-plus-core\3.4.2\mybatis-plus-core-3.4.2.jar;D:\Repository\com\baomidou\mybatis-plus-annotation\3.4.2\mybatis-plus-annotation-3.4.2.jar;D:\Repository\com\github\jsqlparser\jsqlparser\4.0\jsqlparser-4.0.jar;D:\Repository\org\mybatis\mybatis\3.5.6\mybatis-3.5.6.jar;D:\Repository\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;D:\Repository\com\baomidou\mybatis-plus-generator\3.4.1\mybatis-plus-generator-3.4.1.jar;D:\Repository\org\apache\velocity\velocity-engine-core\2.0\velocity-engine-core-2.0.jar;D:\Repository\org\apache\commons\commons-lang3\3.11\commons-lang3-3.11.jar;D:\Repository\org\springframework\boot\spring-boot-starter-data-redis\2.4.3\spring-boot-starter-data-redis-2.4.3.jar;D:\Repository\org\springframework\data\spring-data-redis\2.4.5\spring-data-redis-2.4.5.jar;D:\Repository\org\springframework\data\spring-data-keyvalue\2.4.5\spring-data-keyvalue-2.4.5.jar;D:\Repository\org\springframework\spring-tx\5.3.4\spring-tx-5.3.4.jar;D:\Repository\org\springframework\spring-oxm\5.3.4\spring-oxm-5.3.4.jar;D:\Repository\org\springframework\spring-context-support\5.3.4\spring-context-support-5.3.4.jar;D:\Repository\io\lettuce\lettuce-core\6.0.2.RELEASE\lettuce-core-6.0.2.RELEASE.jar;D:\Repository\io\netty\netty-common\4.1.59.Final\netty-common-4.1.59.Final.jar;D:\Repository\io\netty\netty-handler\4.1.59.Final\netty-handler-4.1.59.Final.jar;D:\Repository\io\netty\netty-resolver\4.1.59.Final\netty-resolver-4.1.59.Final.jar;D:\Repository\io\netty\netty-buffer\4.1.59.Final\netty-buffer-4.1.59.Final.jar;D:\Repository\io\netty\netty-codec\4.1.59.Final\netty-codec-4.1.59.Final.jar;D:\Repository\io\netty\netty-transport\4.1.59.Final\netty-transport-4.1.59.Final.jar;D:\Repository\io\projectreactor\reactor-core\3.4.3\reactor-core-3.4.3.jar;D:\Repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;D:\Repository\org\apache\commons\commons-pool2\2.9.0\commons-pool2-2.9.0.jar;D:\Repository\com\google\guava\guava\30.1-jre\guava-30.1-jre.jar;D:\Repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\Repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\Repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\Repository\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar;D:\Repository\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;D:\Repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;D:\Repository\com\github\axet\kaptcha\0.0.9\kaptcha-0.0.9.jar;D:\Repository\com\jhlabs\filters\2.0.235\filters-2.0.235.jar;D:\Repository\com\alibaba\fastjson\1.2.60\fastjson-1.2.60.jar;D:\Repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;D:\Repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\Repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\Repository\com\github\tobato\fastdfs-client\1.26.7\fastdfs-client-1.26.7.jar;D:\Repository\org\slf4j\jcl-over-slf4j\1.7.30\jcl-over-slf4j-1.7.30.jar;D:\Repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\Repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\Repository\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\Repository\org\hibernate\validator\hibernate-validator\6.1.7.Final\hibernate-validator-6.1.7.Final.jar;D:\Repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\Repository\org\springframework\spring-context\5.3.4\spring-context-5.3.4.jar;D:\Repository\net\coobird\thumbnailator\0.4.8\thumbnailator-0.4.8.jar;D:\Repository\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;D:\Repository\io\jsonwebtoken\jjwt\0.9.1\jjwt-0.9.1.jar;D:\Repository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;D:\Repository\com\github\ulisesbocchio\jasypt-spring-boot-starter\3.0.2\jasypt-spring-boot-starter-3.0.2.jar;D:\Repository\com\github\ulisesbocchio\jasypt-spring-boot\3.0.2\jasypt-spring-boot-3.0.2.jar;D:\Repository\org\jasypt\jasypt\1.9.3\jasypt-1.9.3.jar;D:\Repository\io\minio\minio\8.1.0\minio-8.1.0.jar;D:\Repository\com\carrotsearch\thirdparty\simple-xml-safe\2.7.1\simple-xml-safe-2.7.1.jar;D:\Repository\com\squareup\okhttp3\okhttp\3.14.9\okhttp-3.14.9.jar;D:\Repository\com\squareup\okio\okio\1.17.2\okio-1.17.2.jar;D:\Repository\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;D:\Repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;D:\Repository\org\springframework\boot\spring-boot-starter-data-elasticsearch\2.4.3\spring-boot-starter-data-elasticsearch-2.4.3.jar;D:\Repository\org\springframework\data\spring-data-elasticsearch\4.1.5\spring-data-elasticsearch-4.1.5.jar;D:\Repository\org\springframework\data\spring-data-commons\2.4.5\spring-data-commons-2.4.5.jar;D:\Repository\org\elasticsearch\plugin\transport-netty4-client\7.9.3\transport-netty4-client-7.9.3.jar;D:\Repository\io\netty\netty-codec-http\4.1.59.Final\netty-codec-http-4.1.59.Final.jar;D:\Repository\org\elasticsearch\client\elasticsearch-rest-high-level-client\7.6.2\elasticsearch-rest-high-level-client-7.6.2.jar;D:\Repository\org\elasticsearch\plugin\mapper-extras-client\7.6.2\mapper-extras-client-7.6.2.jar;D:\Repository\org\elasticsearch\plugin\parent-join-client\7.6.2\parent-join-client-7.6.2.jar;D:\Repository\org\elasticsearch\plugin\aggs-matrix-stats-client\7.6.2\aggs-matrix-stats-client-7.6.2.jar;D:\Repository\org\elasticsearch\plugin\rank-eval-client\7.6.2\rank-eval-client-7.6.2.jar;D:\Repository\org\elasticsearch\plugin\lang-mustache-client\7.6.2\lang-mustache-client-7.6.2.jar;D:\Repository\com\github\spullara\mustache\java\compiler\0.9.6\compiler-0.9.6.jar;D:\Repository\org\elasticsearch\elasticsearch\7.6.2\elasticsearch-7.6.2.jar;D:\Repository\org\elasticsearch\elasticsearch-core\7.6.2\elasticsearch-core-7.6.2.jar;D:\Repository\org\elasticsearch\elasticsearch-secure-sm\7.6.2\elasticsearch-secure-sm-7.6.2.jar;D:\Repository\org\elasticsearch\elasticsearch-x-content\7.6.2\elasticsearch-x-content-7.6.2.jar;D:\Repository\com\fasterxml\jackson\dataformat\jackson-dataformat-smile\2.11.4\jackson-dataformat-smile-2.11.4.jar;D:\Repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.11.4\jackson-dataformat-yaml-2.11.4.jar;D:\Repository\com\fasterxml\jackson\dataformat\jackson-dataformat-cbor\2.11.4\jackson-dataformat-cbor-2.11.4.jar;D:\Repository\org\elasticsearch\elasticsearch-geo\7.6.2\elasticsearch-geo-7.6.2.jar;D:\Repository\org\apache\lucene\lucene-core\8.4.0\lucene-core-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-analyzers-common\8.4.0\lucene-analyzers-common-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-backward-codecs\8.4.0\lucene-backward-codecs-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-grouping\8.4.0\lucene-grouping-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-highlighter\8.4.0\lucene-highlighter-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-join\8.4.0\lucene-join-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-memory\8.4.0\lucene-memory-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-misc\8.4.0\lucene-misc-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-queries\8.4.0\lucene-queries-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-queryparser\8.4.0\lucene-queryparser-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-sandbox\8.4.0\lucene-sandbox-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-spatial\8.4.0\lucene-spatial-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-spatial-extras\8.4.0\lucene-spatial-extras-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-spatial3d\8.4.0\lucene-spatial3d-8.4.0.jar;D:\Repository\org\apache\lucene\lucene-suggest\8.4.0\lucene-suggest-8.4.0.jar;D:\Repository\org\elasticsearch\elasticsearch-cli\7.6.2\elasticsearch-cli-7.6.2.jar;D:\Repository\net\sf\jopt-simple\jopt-simple\5.0.2\jopt-simple-5.0.2.jar;D:\Repository\com\carrotsearch\hppc\0.8.1\hppc-0.8.1.jar;D:\Repository\joda-time\joda-time\2.10.4\joda-time-2.10.4.jar;D:\Repository\com\tdunning\t-digest\3.2\t-digest-3.2.jar;D:\Repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;D:\Repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\Repository\org\elasticsearch\jna\4.5.1\jna-4.5.1.jar;D:\Repository\org\elasticsearch\client\elasticsearch-rest-client\7.6.2\elasticsearch-rest-client-7.6.2.jar;D:\Repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;D:\Repository\org\apache\httpcomponents\httpcore\4.4.14\httpcore-4.4.14.jar;D:\Repository\org\apache\httpcomponents\httpasyncclient\4.1.4\httpasyncclient-4.1.4.jar;D:\Repository\org\apache\httpcomponents\httpcore-nio\4.4.14\httpcore-nio-4.4.14.jar;D:\Repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar" com.yinchd.web.CodeGenerator
Connected to the target VM, address: '127.0.0.1:59499', transport: 'socket'
开始生成如下表:t_test 到 com.yinchd.web 目录中...
16:59:49.843 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================准备生成文件...==========================
16:59:50.480 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
16:59:50.480 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.0
16:59:50.485 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
16:59:50.507 [main] DEBUG org.apache.velocity - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.510 [main] DEBUG org.apache.velocity - initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) with class java.util.Collections$SynchronizedMap cache map.
16:59:50.512 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Stop
16:59:50.514 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Define
16:59:50.515 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Break
16:59:50.515 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Evaluate
16:59:50.516 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
16:59:50.518 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
16:59:50.519 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Include
16:59:50.520 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
16:59:50.542 [main] DEBUG org.apache.velocity.parser - Created '20' parsers.
16:59:50.577 [main] DEBUG org.apache.velocity.macro - "velocimacro.library" is not set. Trying default library: VM_global_library.vm
16:59:50.578 [main] DEBUG org.apache.velocity.loader.file - Could not load resource 'VM_global_library.vm' from ResourceLoader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.578 [main] DEBUG org.apache.velocity.macro - Default library not found.
16:59:50.578 [main] DEBUG org.apache.velocity.macro - allowInline = true: VMs can be defined inline in templates
16:59:50.578 [main] DEBUG org.apache.velocity.macro - allowInlineToOverride = false: VMs defined inline may NOT replace previous VM definitions
16:59:50.578 [main] DEBUG org.apache.velocity.macro - allowInlineLocal = false: VMs defined inline will be global in scope if allowed.
16:59:50.578 [main] DEBUG org.apache.velocity.macro - autoload off: VM system will not automatically reload global library macros
16:59:50.622 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/entity.java.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.626 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.626 [main] DEBUG org.apache.velocity.rendering - == Class: class java.util.HashMap
16:59:50.628 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.util.HashMap
16:59:50.630 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.remove(java.lang.Object)
16:59:50.630 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.remove(java.lang.Object,java.lang.Object)
16:59:50.630 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.get(java.lang.Object)
16:59:50.630 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.put(java.lang.Object,java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Collection java.util.HashMap.values()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.clone()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.clear()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.isEmpty()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.replace(java.lang.Object,java.lang.Object,java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.replace(java.lang.Object,java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.replaceAll(java.util.function.BiFunction)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public int java.util.HashMap.size()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Set java.util.HashMap.entrySet()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.putAll(java.util.Map)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.putIfAbsent(java.lang.Object,java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public void java.util.HashMap.forEach(java.util.function.BiConsumer)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Set java.util.HashMap.keySet()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.compute(java.lang.Object,java.util.function.BiFunction)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.computeIfAbsent(java.lang.Object,java.util.function.Function)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.computeIfPresent(java.lang.Object,java.util.function.BiFunction)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.containsKey(java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.util.HashMap.containsValue(java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.Object java.util.HashMap.getOrDefault(java.lang.Object,java.lang.Object)
16:59:50.631 [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)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.util.Map
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public abstract boolean java.util.Map.equals(java.lang.Object)
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public abstract int java.util.Map.hashCode()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.lang.Cloneable
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.io.Serializable
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.util.AbstractMap
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.util.AbstractMap.toString()
16:59:50.631 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.util.Map
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.lang.Object
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait() throws java.lang.InterruptedException
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final native java.lang.Class java.lang.Object.getClass()
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notify()
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notifyAll()
16:59:50.632 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - == Class: class com.baomidou.mybatisplus.generator.config.po.TableInfo
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - Reflecting class com.baomidou.mybatisplus.generator.config.po.TableInfo
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableInfo.equals(java.lang.Object)
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.toString()
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - Adding public int com.baomidou.mybatisplus.generator.config.po.TableInfo.hashCode()
16:59:50.635 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.List com.baomidou.mybatisplus.generator.config.po.TableInfo.getFields()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getComment()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setComment(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setServiceName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setMapperName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setXmlName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setEntityName(com.baomidou.mybatisplus.generator.config.StrategyConfig,java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setEntityName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setConvert(boolean)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableInfo.isConvert()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableInfo.isLogicDelete(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getServiceName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getEntityPath()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getMapperName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getEntityName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getXmlName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setServiceImplName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setImportPackages(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setControllerName(java.lang.String)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getServiceImplName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getControllerName()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Set com.baomidou.mybatisplus.generator.config.po.TableInfo.getImportPackages()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setHavePrimaryKey(boolean)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setCommonFields(java.util.List)
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableInfo.isHavePrimaryKey()
16:59:50.636 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableInfo.getFieldNames()
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setFields(java.util.List)
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableInfo com.baomidou.mybatisplus.generator.config.po.TableInfo.setFieldNames(java.lang.String)
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.List com.baomidou.mybatisplus.generator.config.po.TableInfo.getCommonFields()
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.lang.Object
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait() throws java.lang.InterruptedException
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final native java.lang.Class java.lang.Object.getClass()
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notify()
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notifyAll()
16:59:50.637 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.639 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.639 [main] DEBUG org.apache.velocity.rendering - == Class: class com.baomidou.mybatisplus.generator.config.po.TableField
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Reflecting class com.baomidou.mybatisplus.generator.config.po.TableField
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableField.equals(java.lang.Object)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.toString()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public int com.baomidou.mybatisplus.generator.config.po.TableField.hashCode()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getName()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setName(java.lang.String)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getType()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getComment()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setComment(java.lang.String)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableField.isKeyFlag()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getPropertyType()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getPropertyName()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setConvert(boolean)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableField.isConvert()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setPropertyName(com.baomidou.mybatisplus.generator.config.StrategyConfig,java.lang.String)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setPropertyName(java.lang.String)
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getAnnotationColumnName()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableField.isKeyIdentityFlag()
16:59:50.640 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setKeyIdentityFlag(boolean)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setColumnType(com.baomidou.mybatisplus.generator.config.rules.IColumnType)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setFill(java.lang.String)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setType(java.lang.String)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setKeyFlag(boolean)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setCustomMap(java.util.Map)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public boolean com.baomidou.mybatisplus.generator.config.po.TableField.isKeyWords()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setKeyWords(boolean)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.po.TableField com.baomidou.mybatisplus.generator.config.po.TableField.setColumnName(java.lang.String)
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getColumnName()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public com.baomidou.mybatisplus.generator.config.rules.IColumnType com.baomidou.mybatisplus.generator.config.po.TableField.getColumnType()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public java.util.Map com.baomidou.mybatisplus.generator.config.po.TableField.getCustomMap()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getFill()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String com.baomidou.mybatisplus.generator.config.po.TableField.getCapitalName()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.lang.Object
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait() throws java.lang.InterruptedException
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final native java.lang.Class java.lang.Object.getClass()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notify()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notifyAll()
16:59:50.641 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.645 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - == Class: class java.lang.String
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.lang.String
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.equals(java.lang.Object)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.toString()
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.hashCode()
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.compareTo(java.lang.String)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.compareTo(java.lang.Object)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.indexOf(java.lang.String,int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.indexOf(java.lang.String)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.indexOf(int,int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.indexOf(int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(long)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(float)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(boolean)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(char[])
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(char[],int,int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(java.lang.Object)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(char)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.valueOf(double)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public char java.lang.String.charAt(int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.codePointAt(int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.codePointBefore(int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.codePointCount(int,int)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.compareToIgnoreCase(java.lang.String)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.concat(java.lang.String)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.contains(java.lang.CharSequence)
16:59:50.646 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.contentEquals(java.lang.CharSequence)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.contentEquals(java.lang.StringBuffer)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.copyValueOf(char[])
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.copyValueOf(char[],int,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.endsWith(java.lang.String)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.equalsIgnoreCase(java.lang.String)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.format(java.util.Locale,java.lang.String,java.lang.Object[])
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.format(java.lang.String,java.lang.Object[])
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public void java.lang.String.getBytes(int,int,byte[],int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public byte[] java.lang.String.getBytes(java.nio.charset.Charset)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public byte[] java.lang.String.getBytes(java.lang.String) throws java.io.UnsupportedEncodingException
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public byte[] java.lang.String.getBytes()
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public void java.lang.String.getChars(int,int,char[],int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public native java.lang.String java.lang.String.intern()
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.isEmpty()
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.join(java.lang.CharSequence,java.lang.CharSequence[])
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public static java.lang.String java.lang.String.join(java.lang.CharSequence,java.lang.Iterable)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.lastIndexOf(int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.lastIndexOf(java.lang.String)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.lastIndexOf(java.lang.String,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.lastIndexOf(int,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.length()
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.matches(java.lang.String)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public int java.lang.String.offsetByCodePoints(int,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.regionMatches(int,java.lang.String,int,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.regionMatches(boolean,int,java.lang.String,int,int)
16:59:50.647 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.replace(char,char)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.replace(java.lang.CharSequence,java.lang.CharSequence)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String[] java.lang.String.split(java.lang.String)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String[] java.lang.String.split(java.lang.String,int)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.startsWith(java.lang.String,int)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public boolean java.lang.String.startsWith(java.lang.String)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.CharSequence java.lang.String.subSequence(int,int)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.substring(int)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.substring(int,int)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public char[] java.lang.String.toCharArray()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.toLowerCase(java.util.Locale)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.toLowerCase()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.toUpperCase()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.toUpperCase(java.util.Locale)
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public java.lang.String java.lang.String.trim()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.io.Serializable
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.lang.Comparable
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Reflecting interface java.lang.CharSequence
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public default java.util.stream.IntStream java.lang.CharSequence.chars()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public default java.util.stream.IntStream java.lang.CharSequence.codePoints()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Reflecting class java.lang.Object
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait() throws java.lang.InterruptedException
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final native java.lang.Class java.lang.Object.getClass()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notify()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - Adding public final native void java.lang.Object.notifyAll()
16:59:50.648 [main] DEBUG org.apache.velocity.rendering - =================================================================
16:59:50.651 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\model\TestModel.java
16:59:50.653 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /generator/mapper.java.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.654 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/generator/mapper.java.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\mapper\TestMapper.java
16:59:50.657 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/mapper.xml.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.660 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\mapper\xml\TestMapper.xml
16:59:50.662 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/service.java.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.663 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\service\TestService.java
16:59:50.666 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/serviceImpl.java.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.667 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\service\impl\TestServiceImpl.java
16:59:50.670 [main] DEBUG org.apache.velocity.loader - ResourceManager: found /templates/controller.java.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
16:59:50.760 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.vm;  文件:D:\WorkSpace\myweb-boot/src/main/java\com\yinchd\web\controller\TestController.java
16:59:50.760 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================文件生成完成!!!==========================
生成成功...
Disconnected from the target VM, address: '127.0.0.1:59499', transport: 'socket'

Process finished with exit code 0

来看下生成效果

成功生成文件到指定位置

在这里插入图片描述

如果这里没有生成到指定目录,请按如下步骤检查

在这里插入图片描述

检查下工作目录(Working directory)是不是在当前项目路径,如果不是,请改到项目目录下去

在这里插入图片描述
TestModel效果

package com.yinchd.web.model;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 测试表
 * </p>
 *
 * @author yinchd
 * @since 2021-04-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_test")
@ApiModel(value="TestModel对象", description="测试表")
public class TestModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id主键")
      @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "名称")
    @TableField("name")
    private String name;

    @ApiModelProperty(value = "性别")
    @TableField("sex")
    private String sex;

    @ApiModelProperty(value = "爱好")
    @TableField("hobby")
    private String hobby;

    @ApiModelProperty(value = "手机号")
    @TableField("mobile")
    private String mobile;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;


    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String SEX = "sex";

    public static final String HOBBY = "hobby";

    public static final String MOBILE = "mobile";

    public static final String CREATE_TIME = "create_time";

}

TestController

package com.yinchd.web.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 测试表 前端控制器
 * </p>
 *
 * @author yinchd
 * @since 2021-04-22
 */
@RestController
@RequestMapping("/test-model")
public class TestController {

}

TestService

package com.yinchd.web.service;

import com.yinchd.web.model.TestModel;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 * 测试表 服务类
 * </p>
 *
 * @author yinchd
 * @since 2021-04-22
 */
public interface TestService extends IService<TestModel> {

}

TestServiceImpl

package com.yinchd.web.service.impl;

import com.yinchd.web.model.TestModel;
import com.yinchd.web.mapper.TestMapper;
import com.yinchd.web.service.TestService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 测试表 服务实现类
 * </p>
 *
 * @author yinchd
 * @since 2021-04-22
 */
@Service
public class TestServiceImpl extends ServiceImpl<TestMapper, TestModel> implements TestService {

}

TestMapper

package com.yinchd.web.mapper;

import com.yinchd.web.model.TestModel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * 测试表 Mapper 接口
 * </p>
 *
 * @author yinchd
 * @since 2021-04-22
 */
@Mapper
public interface TestMapper extends BaseMapper<TestModel> {

}

TestMapper.xml

<?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="com.yinchd.web.mapper.TestMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yinchd.web.model.TestModel">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="sex" property="sex" />
        <result column="hobby" property="hobby" />
        <result column="mobile" property="mobile" />
        <result column="create_time" property="createTime" />
    </resultMap>

</mapper>

3.4 执行测试用例测试

@SpringBootTest
@RunWith(SpringRunner.class)
public class JavaUnitTest {

    @Resource
    TestService testService;

    @Test
    public void test() {
        List<TestModel> list = testService.list();
        System.out.println(list.size());
    }

}

打断点看一下效果

在这里插入图片描述

Bingo!以后生成代码就很方便了

当然市面上也有很多其它的代码生成工具,大家自行对比看哪个比较好用,建议大家有时间了解一下代码生成工具的实现原理,以后我们自己写工具类的时候可以参考借鉴。

加载全部内容

相关教程
猜你喜欢
用户评论