mybatis plus的自动生成代码配置文件

近期项目中使用到了mybatis plus,现将配置文件记录一下

public class MpAutoGenerator {
    public static void main(String[] args) {
        AutoGenerator mpg = new AutoGenerator();
        mpg.setGlobalConfig(new GlobalConfig()
                .setAuthor("hcl")
                .setActiveRecord(true)
                .setFileOverride(true)
                .setOutputDir("F:/project/gradle/src/main/java")
                .setBaseColumnList(true)
                .setEnableCache(false)
                .setBaseResultMap(true)
                .setOpen(false)
                .setMapperName("%sMapper")
                .setXmlName("%sMapper")
                .setServiceName("%sService")
                .setServiceImplName("%sServiceImpl")
                .setControllerName("%sController")
        );
        mpg.setStrategy(new StrategyConfig()
                .setNaming(NamingStrategy.underline_to_camel)
                .setTablePrefix("t_")
                .setEntityLombokModel(true)
                .setRestControllerStyle(true)
                .setInclude(new String[]{"t_user_faceid_infos"})
        );
        mpg.setDataSource(new DataSourceConfig()
                .setDbType(DbType.MYSQL)
                .setUrl("jdbc:mysql://10.10.60.xx:3306/sp2p_xxx?useSSL=false")
                .setUsername("xxx")
                .setPassword("xxx")
                .setDriverName("com.mysql.cj.jdbc.Driver")
        );
        mpg.setPackageInfo(new PackageConfig()
                .setParent("com.gradle.demo")
                .setMapper("mapper")
                .setEntity("entity")
                .setService("service")
                .setServiceImpl("service.impl")
                .setController("controller")
        );
        mpg.execute();
    }
}

 

你可能感兴趣的:(mybatis plus的自动生成代码配置文件)