package com.yqzx.generator.action.config; /** * @description: 默认的代码生成的配置 一般生成配置 * @author: chaoyapeng * @time: 2020/8/18 15:52 */ public class GeneratorConfig extends AbstractGeneratorConfig { private String tableName; private String bizChName; private String author; private String projectPath; private String packageName; public GeneratorConfig setTableName(String tableName) { this.tableName = tableName; return this; } public GeneratorConfig setBizChName(String bizChName) { this.bizChName = bizChName; return this; } public GeneratorConfig setAuthor(String author) { this.author = author; return this; } public GeneratorConfig setProjectPath(String projectPath) { this.projectPath = projectPath; return this; } public GeneratorConfig setPackageName(String packageName) { this.packageName = packageName; return this; } protected void dataSourceConfig() { dataSourceConfig.setDriverName("com.mysql.jdbc.Driver"); dataSourceConfig.setUsername("root"); dataSourceConfig.setPassword("Bjjmy_2020"); dataSourceConfig.setUrl( "jdbc:mysql://116.198.40.76:3306/project_manage2_prod?characterEncoding=utf8&autoReconnect=true&useSSL=false"); } protected void contextConfig() { contextConfig.setAuthor(author); contextConfig.setProjectPath(projectPath); contextConfig.setPackageName(packageName); contextConfig.setTableName(tableName); contextConfig.setBizChName(bizChName); // 生成器开关 contextConfig.setControllerSwitch(true); contextConfig.setServiceSwitch(true); contextConfig.setMapperSwitch(true); contextConfig.setModelSwitch(true); contextConfig.setQuerySwitch(true); } @Override protected void config() { dataSourceConfig(); contextConfig(); } }