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

一、先看下项目结构

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!以后生成代码就很方便了

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

到此这篇关于Java实战之实现一个好用的MybatisPlus代码生成器的文章就介绍到这了,更多相关Java实现MybatisPlus代码生成器内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • java高并发情况下高效的随机数生成器

    前言 在代码中生成随机数,是一个非常常用的功能,并且JDK已经提供了一个现成的Random类来实现它,并且Random类是线程安全的. 下面是Random.next()生成一个随机整数的实现: protected int next(int bits) { long oldseed, nextseed; AtomicLong seed = this.seed; do { oldseed = seed.get(); nextseed = (oldseed * multiplier + addend)

  • 23种设计模式(4) java生成器模式

    23种设计模式第四篇:java生成器模式 定义: 将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示.生成器模式利用一个导演者对象和具体建造者对象一个一个地建造出所有的零件,从而建造出完整的对象. 四个要素: Builder:生成器接口,定义创建一个Product对象所需要的各个部件的操作.         ConcreteBuilder:具体的生成器实现,实现各个部件的创建,并负责组装Product对象的各个部件,同时还提供一个让用户获取组装完成后的产品对象的方法.   

  • java实现双色球机选号码生成器

    本文实例为大家分享了java实现双色球机选号码生成器的具体代码,供大家参考,具体内容如下 双色球号码1~32不重复选6个(排序好),1~16中选一个(蓝号) import java.util.Random; import java.util.Arrays; //操作数组的工具类 /** * 双色球号码机选 * * @author Administrator * */ public class Lettery { public static void main(String[] args) { f

  • java实现随机数生成器

    本文实例为大家分享了java实现随机数生成器的具体代码,供大家参考,具体内容如下 自己编的随机数生成器,比较简陋,功能也单一,当作练手. Application.java package src; public class Application { public static void main(String[] args) { WindowBoxLayout win=new WindowBoxLayout(); win.setBounds(100,200,300,350); win.setT

  • Java代码生成器的制作流程详解

    1. 前言 前几天写了篇关于Mybatis Plus代码生成器的文章,不少同学私下问我这个代码生成器是如何运作的,为什么要用到一些模板引擎,所以今天来说明下代码生成器的流程. 2. 代码生成器的使用场景 我们在编码中存在很多样板代码,格式较为固定,结构随着项目的迭代也比较稳定,而且数量巨大,这种代码写多了也没有什么技术含量,在这种情况下代码生成器可以有效提高我们的效率,其它情况并不适于使用代码生成器. 3. 代码生成器的制作流程 首先我们要制作模板,把样板代码的固定格式抽出来.然后把动态属性绑定

  • Java实现简单字符生成器代码例子

    创建成功的字符串对象,其长度是固定的,内容是不能被修改和编辑.虽然使用"+"可以达到增加新字符或字符串的目的,但"+"会产生一个新的String实例,会在内存中创建新的字符串对象.如果重复地对字符串进行修改,将极大地增加系统开销.J2SE自5.0增加了可变的字符序列String-Builder类,大大地提高了频繁增加字符串的效率.下面看个简单的例子. public class Jerque { /** * 比较一般情况下的字符串生成器,和String-Builder

  • Java的MyBatis框架中MyBatis Generator代码生成器的用法

    关于Mybatis Generator MyBatis Generator (MBG) 是一个Mybatis的代码生成器 MyBatis 和 iBATIS. 他可以生成Mybatis各个版本的代码,和iBATIS 2.2.0版本以后的代码. 他可以内省数据库的表(或多个表)然后生成可以用来访问(多个)表的基础对象. 这样和数据库表进行交互时不需要创建对象和配置文件. MBG的解决了对数据库操作有最大影响的一些简单的CRUD(插入,查询,更新,删除)操作. 您仍然需要对联合查询和存储过程手写SQL

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

    一.先看下项目结构 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 xm

  • Java实战入门之双色球彩票小游戏

    一.项目需求 二.项目思路 1.菜单制作 2.中奖号码生成 getNumber (随机数 Math.random) 3.购买号码和中奖号码比对 生成中奖等级 package com.test.mxl; import java.util.Scanner; public class Test { public static void main(String[] args) { int[] balls = new int[7]; int count = 0; boolean isBuy = false

  • java实战之飞机大战小游戏(源码加注释)

    一.工程文件 二.Main.java 主函数,实现类 package ui; //主函数实现 public class Main { public static void main(String[] args) { //创建窗体 GameFrame frame = new GameFrame(); //创建面板 GamePanel panel = new GamePanel(frame); //调用开始游戏的方法启动游戏 panel.action(); //将面板加入到窗体中 frame.add

  • Java实战之客户信息管理系统

    一.软件设计结构 对于初学者来说,弄清框架显得尤为重要 首先该软件有以下三种模块组成 二.MVC设计模式 模型层:Customer处理数据 控制层:CustomerList处理业务逻辑 视图层:CustomerView显示数据 以下三点建议结合代码理解 1.Customer为实体对象,用于封装客户信息 2.CustomerList为Customer对象的管理模块,内部用数组管理一组Customer对象,并提供相应的添加.修改.删除和遍历的方法,供CustomerView调用 3.Customer

  • Java实战之基于I/O流设计的图书管理系统

    一.前言 当前,我还没有学到数据库相关的知识,想要完全通过Java来完成一个可以存储数据的图书馆管理系统就只能使用I/O流的知识,将内容都保存到文件中,再进行增删改查的操作,这就很考验我们的Java基础知识掌握能力. 二.项目介绍 Java基本语法的掌握 流程控制语句的熟练使用 面向对象思想的理解 能否熟练使用封装.继承.多态 接口.异常的熟悉 集合的使用 是否熟悉掌握I/O流相关操作 三.项目说明 传统的人工管理图书馆流程繁琐,我们需求设计一个图书馆管理系统来方便学生借书以及管理员管理书籍 系

  • Java实战之吃货联盟订餐系统

    一.前言 刚刚学完java基础入门,主要学习Java基本环境搭建,定义变量.选择结构,循环结构.数组等.本阶段结束尝试接触此次吃货联盟订餐系统,第一次敲这么长的代码,后面多见识见识应该就好了,多加努力啊! 吃货联盟订餐系统包含的功能:我要订餐.查看餐袋.签收订单.删除订单.我要点赞.退出系统 二.基本业务分析 我要订餐 1.输入订餐人姓名 2.将所有的菜品进行展示 3.输入要订的菜品序号 4.输入要订的菜品份数 5.输入配送时间 6.输入配送地址 7.显示订餐信息 查看餐袋 1.直接展示所有的订

  • Java实战之城市多音字处理

    一.需求 对城市名称转化为拼音的时候,当遇到多音字城市的时候,转化拼音就不是我们想要的了. 使用  pinyin4j 无法直接解决这个问题. .网上有很多维护多音字信息的,觉得麻烦. 如: 长沙 ====>"zhangsha" 厦门===>"shamen" 重庆===>"zhongqing" 二.导入 jpinyin 版本自选 <!-- https://mvnrepository.com/artifact/com.gith

  • Java实战之敏感词过滤器

    一.导包 本文的敏感词过滤器用在SpringBoot项目中,因此,首先需要在pom.xml文件中导入如下依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>org.spring

  • Java实战之用Spring开发条形码和验证码

    一.条形码 代码如下: import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.util.Random; public class Text extends JFrame { private static final int WIDTH=300;//窗口的宽度 private static final int HEIGHT=400;//窗口的高度 private stati

  • Java实战之基于swing的QQ邮件收发功能实现

    一.电子邮件详解 假设自己的电子邮件是me@163.com,对方的邮件是you@163.com 我们编写好文件填写好对方文件,点击发送,这些电子邮件就发出去了 而这些电子邮件被称为MUA:Mail User Agent--邮件用户代理. Email发送出去的时候,不是直接到达对方的电脑,而是先发送到MTA:Mail Transfer Agent--邮件传输代理.如:网易 Email到达MTA后,MTA会把Emain投递到邮件的最终目的MDA:Mail Delivery Agent--邮件投递代理

随机推荐