This commit is contained in:
yulichang 2024-01-15 01:13:00 +08:00
parent 15fefbd458
commit a286bf811d

View File

@ -49,7 +49,7 @@ public class XPluginImpl implements Plugin {
} }
}); });
// 读取配置 // 读取配置
Prop prop = new Prop(context.cfg().getProp("mybatis-plus-join")); Prop prop = new Prop(context.cfg());
ConfigProperties.banner = prop.get("banner", Boolean::parseBoolean); ConfigProperties.banner = prop.get("banner", Boolean::parseBoolean);
ConfigProperties.subTableLogic = prop.get("subTableLogic", Boolean::parseBoolean); ConfigProperties.subTableLogic = prop.get("subTableLogic", Boolean::parseBoolean);
ConfigProperties.msCache = prop.get("msCache", Boolean::parseBoolean); ConfigProperties.msCache = prop.get("msCache", Boolean::parseBoolean);
@ -76,10 +76,12 @@ public class XPluginImpl implements Plugin {
private final Properties props; private final Properties props;
@SuppressWarnings("SpellCheckingInspection")
public Prop(Props props) { public Prop(Props props) {
this.props = new Properties(); this.props = props.entrySet().stream().filter(e -> format(e.getKey().toString())
props.forEach((k, v) -> this.props.put(k.toString() .startsWith("MYBATISPLUSJOIN.")).collect(Collectors.toMap(e -> e.getKey().toString()
.replaceAll("[-_]", "").toUpperCase(Locale.ENGLISH), v)); .substring(e.getKey().toString().lastIndexOf(".") + 1)
.toUpperCase(Locale.ENGLISH), Map.Entry::getValue, (o, n) -> n, Properties::new));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -92,5 +94,9 @@ public class XPluginImpl implements Plugin {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
private String format(String key) {
return key.replaceAll("[-_]", "").toUpperCase(Locale.ENGLISH);
}
} }
} }