springboot教程(四) - 集成mybatis-plus代码生成器

pom.xml文件中新增相关依赖

        <!--mybatis-plus 码生成器模板引擎依赖-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
            <version>${mybatis-plus.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>

编写测试程序

package ichpeng.springboot.demo;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: ichpeng@qq.com
 * @date: 2021/3/18 9:05
 * @description:
 */
@Slf4j
public class CodeGenerator {

    /**
     * 代码生成器的配置常量
     */
    //表名,可以设置多个,通过英文逗号分隔
    //数据库用户密码,必须使用表的所有者(Owner)
    private static String[] tables;
    //模块名称,分业务,不要漏最后面一个点
    private static String moduleName = "test.";
    //表名前缀
    private static String tablePrefix = "";
    private static String outPutDir = "/src/test/java";

    private static String jdbcUserName = "root";
    private static String jdbcPassword = "111111";
    private static String jdbcUrl = "jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2B8&characterEncoding=utf8&useSSL=false&useUnicode=true";
    private static String jdbcDriverClassName = "com.mysql.cj.jdbc.Driver";

    /**
     * 主包路径
     */
    private static String parentPackage = "ichpeng.springboot.demo";

    private static String authorName = "ichpeng@qq.com";

    /**
     * dao
     */
    private static String mapperPattern = "%sMapper";
    private static String mapperName = moduleName + "mapper";
    private static String xmlName = mapperName;

    /**
     * service层
     */
    private static String serviceNamePattern = "I%sService";
    private static String serviceName =  moduleName + "service";
    private static String implName =  moduleName + "service.impl";
    private static String pojoName =  moduleName + "bean";
    private static String controllerName =  moduleName + "controller";

    private static String projectPath = System.getProperty("user.dir");

    public static void main(String[] args) {
        // 全局配置
        GlobalConfig gc = new GlobalConfig();
        gc.setOutputDir(projectPath + outPutDir);
        gc.setAuthor(authorName);
        gc.setBaseResultMap(true);
        gc.setBaseColumnList(true);
        // 覆盖生成的文件
        gc.setFileOverride(true);
        gc.setServiceName(serviceNamePattern);
        gc.setMapperName(mapperPattern);
        //是否在xml中添加二级缓存配置:false不生成
        gc.setEnableCache(false);
        //true:生成文件后,自动打开文件夹
        gc.setOpen(false);
        //设置时间类型
        gc.setDateType(DateType.ONLY_DATE);
        //设置生成Swagger2 Api注解
        //gc.setSwagger2(true);

        /**
         * 数据源配置
         */
        DataSourceConfig dsc = new DataSourceConfig();
        dsc.setDbType(DbType.MYSQL);
        dsc.setUrl(jdbcUrl);
        dsc.setDriverName(jdbcDriverClassName);
        dsc.setUsername(jdbcUserName);
        dsc.setPassword(jdbcPassword);
        // dsc.setSchemaName("public");


        /**
         * 包配置
         */
        PackageConfig pc = new PackageConfig();
        //pc.setModuleName(scanner("模块名"));
        pc.setParent(parentPackage);
        pc.setMapper(mapperName);
        pc.setEntity(pojoName);
        pc.setService(serviceName);
        pc.setController(controllerName);
        pc.setServiceImpl(implName);
        pc.setXml(xmlName);


        /**
         * 策略配置
         */
        StrategyConfig strategy = new StrategyConfig();
        strategy.setNaming(NamingStrategy.underline_to_camel);
        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
        //strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
        //设置Lombok模式
        strategy.setEntityLombokModel(false);
        strategy.setRestControllerStyle(true);
        strategy.setControllerMappingHyphenStyle(false);
        // 公共父类
        //strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
        // 写于父类中的公共字段
        //strategy.setSuperEntityColumns("id");
        strategy.setControllerMappingHyphenStyle(true);
        if(!StringUtils.isBlank(tablePrefix)) {
            strategy.setTablePrefix(tablePrefix);
        }
        //strategy.entityTableFieldAnnotationEnable(true);
        strategy.setEntityTableFieldAnnotationEnable(true);
        //Oracle数据,表名一定要大写,且表名要对应创建的用户,否则不生成代码
        //strategy.setInclude(tables);
        //忽略的表明
        //strategy.setExclude(tables);


        InjectionConfig injectionConfig = new InjectionConfig() {
            @Override
            public void initMap() {
                Map<String, Object> map = new HashMap<String, Object>();
                map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp");
                this.setMap(map);
            }
        };


        /**
         * 代码生成器
         */
        AutoGenerator mpg = new AutoGenerator();
        mpg.setGlobalConfig(gc);
        mpg.setDataSource(dsc);
        mpg.setPackageInfo(pc);
        mpg.setStrategy(strategy);
        mpg.setCfg(injectionConfig);
        mpg.setTemplateEngine(new FreemarkerTemplateEngine());

        mpg.execute();
        log.info("代码生成已经完成。" + new Date());
    }
}

生成代码

执行main方法

D:\develop\Java\jdk1.8.0_162\bin\java.exe "-javaagent:D:\develop\JetBrains\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=64072:D:\develop\JetBrains\IntelliJ IDEA 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath D:\develop\Java\jdk1.8.0_162\jre\lib\charsets.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\deploy.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\access-bridge-64.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\cldrdata.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\dnsns.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\jaccess.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\jfxrt.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\localedata.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\nashorn.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\sunec.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\sunjce_provider.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\sunmscapi.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\sunpkcs11.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\ext\zipfs.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\javaws.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\jce.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\jfr.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\jfxswt.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\jsse.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\management-agent.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\plugin.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\resources.jar;D:\develop\Java\jdk1.8.0_162\jre\lib\rt.jar;D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo\target\test-classes;D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo\target\classes;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-web\2.3.9.RELEASE\spring-boot-starter-web-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter\2.3.9.RELEASE\spring-boot-starter-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot\2.3.9.RELEASE\spring-boot-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.3.9.RELEASE\spring-boot-starter-logging-2.3.9.RELEASE.jar;D:\develop\maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\develop\maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\develop\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\develop\maven\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\develop\maven\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\develop\maven\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\develop\maven\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-json\2.3.9.RELEASE\spring-boot-starter-json-2.3.9.RELEASE.jar;D:\develop\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;D:\develop\maven\repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;D:\develop\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;D:\develop\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;D:\develop\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.3.9.RELEASE\spring-boot-starter-tomcat-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.43\tomcat-embed-core-9.0.43.jar;D:\develop\maven\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\develop\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.43\tomcat-embed-websocket-9.0.43.jar;D:\develop\maven\repository\org\springframework\spring-web\5.2.13.RELEASE\spring-web-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-beans\5.2.13.RELEASE\spring-beans-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-webmvc\5.2.13.RELEASE\spring-webmvc-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-aop\5.2.13.RELEASE\spring-aop-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-context\5.2.13.RELEASE\spring-context-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-expression\5.2.13.RELEASE\spring-expression-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\projectlombok\lombok\1.18.18\lombok-1.18.18.jar;D:\develop\maven\repository\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar;D:\develop\maven\repository\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;D:\develop\maven\repository\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;D:\develop\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;D:\develop\maven\repository\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar;D:\develop\maven\repository\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar;D:\develop\maven\repository\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar;D:\develop\maven\repository\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar;D:\develop\maven\repository\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar;D:\develop\maven\repository\com\google\guava\guava\20.0\guava-20.0.jar;D:\develop\maven\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\develop\maven\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\develop\maven\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\develop\maven\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\develop\maven\repository\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;D:\develop\maven\repository\com\github\xiaoymin\swagger-bootstrap-ui\1.9.6\swagger-bootstrap-ui-1.9.6.jar;D:\develop\maven\repository\org\javassist\javassist\3.25.0-GA\javassist-3.25.0-GA.jar;D:\develop\maven\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\develop\maven\repository\mysql\mysql-connector-java\8.0.23\mysql-connector-java-8.0.23.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus-boot-starter\3.3.2\mybatis-plus-boot-starter-3.3.2.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus\3.3.2\mybatis-plus-3.3.2.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.3.9.RELEASE\spring-boot-autoconfigure-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-jdbc\2.3.9.RELEASE\spring-boot-starter-jdbc-2.3.9.RELEASE.jar;D:\develop\maven\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;D:\develop\maven\repository\org\springframework\spring-jdbc\5.2.13.RELEASE\spring-jdbc-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-tx\5.2.13.RELEASE\spring-tx-5.2.13.RELEASE.jar;D:\develop\maven\repository\com\alibaba\druid-spring-boot-starter\1.1.10\druid-spring-boot-starter-1.1.10.jar;D:\develop\maven\repository\com\alibaba\druid\1.1.10\druid-1.1.10.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus-generator\3.3.2\mybatis-plus-generator-3.3.2.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus-extension\3.3.2\mybatis-plus-extension-3.3.2.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus-core\3.3.2\mybatis-plus-core-3.3.2.jar;D:\develop\maven\repository\com\baomidou\mybatis-plus-annotation\3.3.2\mybatis-plus-annotation-3.3.2.jar;D:\develop\maven\repository\com\github\jsqlparser\jsqlparser\3.1\jsqlparser-3.1.jar;D:\develop\maven\repository\org\mybatis\mybatis\3.5.4\mybatis-3.5.4.jar;D:\develop\maven\repository\org\mybatis\mybatis-spring\2.0.4\mybatis-spring-2.0.4.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-freemarker\2.3.9.RELEASE\spring-boot-starter-freemarker-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\freemarker\freemarker\2.3.31\freemarker-2.3.31.jar;D:\develop\maven\repository\org\springframework\spring-context-support\5.2.13.RELEASE\spring-context-support-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-starter-test\2.3.9.RELEASE\spring-boot-starter-test-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-test\2.3.9.RELEASE\spring-boot-test-2.3.9.RELEASE.jar;D:\develop\maven\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.3.9.RELEASE\spring-boot-test-autoconfigure-2.3.9.RELEASE.jar;D:\develop\maven\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;D:\develop\maven\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;D:\develop\maven\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;D:\develop\maven\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;D:\develop\maven\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;D:\develop\maven\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;D:\develop\maven\repository\org\assertj\assertj-core\3.16.1\assertj-core-3.16.1.jar;D:\develop\maven\repository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar;D:\develop\maven\repository\org\junit\jupiter\junit-jupiter\5.6.3\junit-jupiter-5.6.3.jar;D:\develop\maven\repository\org\junit\jupiter\junit-jupiter-api\5.6.3\junit-jupiter-api-5.6.3.jar;D:\develop\maven\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;D:\develop\maven\repository\org\junit\platform\junit-platform-commons\1.6.3\junit-platform-commons-1.6.3.jar;D:\develop\maven\repository\org\junit\jupiter\junit-jupiter-params\5.6.3\junit-jupiter-params-5.6.3.jar;D:\develop\maven\repository\org\junit\jupiter\junit-jupiter-engine\5.6.3\junit-jupiter-engine-5.6.3.jar;D:\develop\maven\repository\org\junit\vintage\junit-vintage-engine\5.6.3\junit-vintage-engine-5.6.3.jar;D:\develop\maven\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;D:\develop\maven\repository\org\junit\platform\junit-platform-engine\1.6.3\junit-platform-engine-1.6.3.jar;D:\develop\maven\repository\junit\junit\4.13.2\junit-4.13.2.jar;D:\develop\maven\repository\org\mockito\mockito-core\3.3.3\mockito-core-3.3.3.jar;D:\develop\maven\repository\net\bytebuddy\byte-buddy\1.10.20\byte-buddy-1.10.20.jar;D:\develop\maven\repository\net\bytebuddy\byte-buddy-agent\1.10.20\byte-buddy-agent-1.10.20.jar;D:\develop\maven\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;D:\develop\maven\repository\org\mockito\mockito-junit-jupiter\3.3.3\mockito-junit-jupiter-3.3.3.jar;D:\develop\maven\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;D:\develop\maven\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\develop\maven\repository\org\springframework\spring-core\5.2.13.RELEASE\spring-core-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-jcl\5.2.13.RELEASE\spring-jcl-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\springframework\spring-test\5.2.13.RELEASE\spring-test-5.2.13.RELEASE.jar;D:\develop\maven\repository\org\xmlunit\xmlunit-core\2.7.0\xmlunit-core-2.7.0.jar ichpeng.springboot.demo.CodeGenerator
10:49:36.508 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================准备生成文件...==========================
10:49:37,831 DEBUG cache:45 - Couldn't find template in cache for "templates/entity.java.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:37,835 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/entity.java_zh_CN.ftl"): Not found
10:49:37,837 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/entity.java_zh.ftl"): Not found
10:49:37,839 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/entity.java.ftl"): Found
10:49:37,839 DEBUG cache:45 - Loading template for "templates/entity.java.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/entity.java.ftl"
10:49:38.299 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\bean\Student.java
10:49:38,299 DEBUG cache:45 - Couldn't find template in cache for "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:38,301 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.java_zh_CN.ftl"): Not found
10:49:38,301 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.java_zh.ftl"): Not found
10:49:38,303 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.java.ftl"): Found
10:49:38,304 DEBUG cache:45 - Loading template for "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/mapper.java.ftl"
10:49:38.308 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\StudentMapper.java
10:49:38,309 DEBUG cache:45 - Couldn't find template in cache for "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:38,310 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.xml_zh_CN.ftl"): Not found
10:49:38,311 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.xml_zh.ftl"): Not found
10:49:38,312 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/mapper.xml.ftl"): Found
10:49:38,312 DEBUG cache:45 - Loading template for "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/mapper.xml.ftl"
10:49:38.323 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\StudentMapper.xml
10:49:38,323 DEBUG cache:45 - Couldn't find template in cache for "templates/service.java.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:38,326 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/service.java_zh_CN.ftl"): Not found
10:49:38,327 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/service.java_zh.ftl"): Not found
10:49:38,328 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/service.java.ftl"): Found
10:49:38,328 DEBUG cache:45 - Loading template for "templates/service.java.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/service.java.ftl"
10:49:38.333 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\IStudentService.java
10:49:38,333 DEBUG cache:45 - Couldn't find template in cache for "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:38,334 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/serviceImpl.java_zh_CN.ftl"): Not found
10:49:38,335 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/serviceImpl.java_zh.ftl"): Not found
10:49:38,336 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/serviceImpl.java.ftl"): Found
10:49:38,336 DEBUG cache:45 - Loading template for "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/serviceImpl.java.ftl"
10:49:38.343 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\impl\StudentServiceImpl.java
10:49:38,344 DEBUG cache:45 - Couldn't find template in cache for "templates/controller.java.ftl"("zh_CN", UTF-8, parsed); will try to load it.
10:49:38,345 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/controller.java_zh_CN.ftl"): Not found
10:49:38,345 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/controller.java_zh.ftl"): Not found
10:49:38,346 DEBUG cache:45 - TemplateLoader.findTemplateSource("templates/controller.java.ftl"): Found
10:49:38,347 DEBUG cache:45 - Loading template for "templates/controller.java.ftl"("zh_CN", UTF-8, parsed) from "jar:file:/D:/develop/maven/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar!/templates/controller.java.ftl"
10:49:38.351 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\controller\StudentController.java
10:49:38,352 DEBUG cache:45 - "templates/entity.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.370 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\bean\TbStudent.java
10:49:38,370 DEBUG cache:45 - "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.372 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TbStudentMapper.java
10:49:38,372 DEBUG cache:45 - "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.375 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TbStudentMapper.xml
10:49:38,376 DEBUG cache:45 - "templates/service.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.377 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\ITbStudentService.java
10:49:38,380 DEBUG cache:45 - "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.382 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\impl\TbStudentServiceImpl.java
10:49:38,383 DEBUG cache:45 - "templates/controller.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.389 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\controller\TbStudentController.java
10:49:38,390 DEBUG cache:45 - "templates/entity.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.404 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\bean\TbTeacher.java
10:49:38,404 DEBUG cache:45 - "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.406 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TbTeacherMapper.java
10:49:38,406 DEBUG cache:45 - "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.410 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TbTeacherMapper.xml
10:49:38,411 DEBUG cache:45 - "templates/service.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.413 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\ITbTeacherService.java
10:49:38,413 DEBUG cache:45 - "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.414 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\impl\TbTeacherServiceImpl.java
10:49:38,414 DEBUG cache:45 - "templates/controller.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.416 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\controller\TbTeacherController.java
10:49:38,417 DEBUG cache:45 - "templates/entity.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.421 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\bean\Teacher.java
10:49:38,421 DEBUG cache:45 - "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.422 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TeacherMapper.java
10:49:38,422 DEBUG cache:45 - "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.424 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\TeacherMapper.xml
10:49:38,424 DEBUG cache:45 - "templates/service.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.425 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\ITeacherService.java
10:49:38,425 DEBUG cache:45 - "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.426 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\impl\TeacherServiceImpl.java
10:49:38,427 DEBUG cache:45 - "templates/controller.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.428 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\controller\TeacherController.java
10:49:38,429 DEBUG cache:45 - "templates/entity.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.434 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/entity.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\bean\User.java
10:49:38,434 DEBUG cache:45 - "templates/mapper.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.436 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\UserMapper.java
10:49:38,436 DEBUG cache:45 - "templates/mapper.xml.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.443 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/mapper.xml.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\mapper\UserMapper.xml
10:49:38,444 DEBUG cache:45 - "templates/service.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.445 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/service.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\IUserService.java
10:49:38,446 DEBUG cache:45 - "templates/serviceImpl.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.447 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/serviceImpl.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\service\impl\UserServiceImpl.java
10:49:38,447 DEBUG cache:45 - "templates/controller.java.ftl"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
10:49:38.449 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 模板:/templates/controller.java.ftl;  文件:D:\develop\Java\idea-workspace\spring-cloud-study\spring-boot-demo/src/test/java\ichpeng\springboot\demo\test\controller\UserController.java
10:49:38.449 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================文件生成完成!!!==========================
10:49:38.449 [main] INFO ichpeng.springboot.demo.CodeGenerator - 代码生成已经完成。Thu Mar 18 10:49:38 CST 2021

Process finished with exit code 0

springboot教程(四) - 集成mybatis-plus代码生成器

上一篇:Gitflow工作流程


下一篇:[AGC035E] Develop