懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.generator.config;
2
3 import org.springframework.beans.factory.annotation.Value;
4 import org.springframework.boot.context.properties.ConfigurationProperties;
5 import org.springframework.context.annotation.PropertySource;
6 import org.springframework.stereotype.Component;
7
8 /**
9  * 读取代码生成相关配置
10  * 
11  * @author jc
12  */
13 @Component
14 @ConfigurationProperties(prefix = "gen")
15 @PropertySource(value = { "classpath:generator.yml" })
16 public class GenConfig
17 {
18     /** 作者 */
19     public static String author;
20
21     /** 生成包路径 */
22     public static String packageName;
23
24     /** 自动去除表前缀,默认是false */
25     public static boolean autoRemovePre;
26
27     /** 表前缀(类名不会包含表前缀) */
28     public static String tablePrefix;
29
30     public static String getAuthor()
31     {
32         return author;
33     }
34
35     @Value("${author}")
36     public void setAuthor(String author)
37     {
38         GenConfig.author = author;
39     }
40
41     public static String getPackageName()
42     {
43         return packageName;
44     }
45
46     @Value("${packageName}")
47     public void setPackageName(String packageName)
48     {
49         GenConfig.packageName = packageName;
50     }
51
52     public static boolean getAutoRemovePre()
53     {
54         return autoRemovePre;
55     }
56
57     @Value("${autoRemovePre}")
58     public void setAutoRemovePre(boolean autoRemovePre)
59     {
60         GenConfig.autoRemovePre = autoRemovePre;
61     }
62
63     public static String getTablePrefix()
64     {
65         return tablePrefix;
66     }
67
68     @Value("${tablePrefix}")
69     public void setTablePrefix(String tablePrefix)
70     {
71         GenConfig.tablePrefix = tablePrefix;
72     }
73 }