fix: 代码生成器为做自定义配置时,生成代码 NPE 的问题; close #I88UIZ

This commit is contained in:
开源海哥 2023-10-17 19:57:29 +08:00
parent 9c204fbcb0
commit 03b0f839cf

View File

@ -53,9 +53,8 @@ public class GlobalConfig implements Serializable {
private TableDefConfig tableDefConfig; private TableDefConfig tableDefConfig;
private MapperXmlConfig mapperXmlConfig; private MapperXmlConfig mapperXmlConfig;
// === 其他配置 === // === 其他自定义配置 ===
private Map<String, Object> customConfig = new HashMap<>();
private Map<String, Object> customConfig;
// === 是否启用生成 === // === 是否启用生成 ===
@ -220,16 +219,10 @@ public class GlobalConfig implements Serializable {
// === 自定义配置 === // === 自定义配置 ===
public Object getCustomConfig(String key) { public Object getCustomConfig(String key) {
if (customConfig != null) { return customConfig.get(key);
return customConfig.get(key);
}
return null;
} }
public void setCustomConfig(String key, Object value) { public void setCustomConfig(String key, Object value) {
if (customConfig == null) {
customConfig = new HashMap<>();
}
customConfig.put(key, value); customConfig.put(key, value);
} }