duhuizhe
2024-04-19 64c4fd3c7067c7626dc960a70b4bc2c3662bc653
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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();
    }
}