From a286bf811d730baf3a291c251b7676af46f64bf6 Mon Sep 17 00:00:00 2001 From: yulichang <570810310@qq.com> Date: Mon, 15 Jan 2024 01:13:00 +0800 Subject: [PATCH] solon --- .../mybatisplusjoin/solon/plugin/XPluginImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mybatis-plus-join-solon-plugin/src/main/java/com/github/yulichang/mybatisplusjoin/solon/plugin/XPluginImpl.java b/mybatis-plus-join-solon-plugin/src/main/java/com/github/yulichang/mybatisplusjoin/solon/plugin/XPluginImpl.java index 655dbc9..f39dc0c 100644 --- a/mybatis-plus-join-solon-plugin/src/main/java/com/github/yulichang/mybatisplusjoin/solon/plugin/XPluginImpl.java +++ b/mybatis-plus-join-solon-plugin/src/main/java/com/github/yulichang/mybatisplusjoin/solon/plugin/XPluginImpl.java @@ -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.subTableLogic = prop.get("subTableLogic", Boolean::parseBoolean); ConfigProperties.msCache = prop.get("msCache", Boolean::parseBoolean); @@ -76,10 +76,12 @@ public class XPluginImpl implements Plugin { private final Properties props; + @SuppressWarnings("SpellCheckingInspection") public Prop(Props props) { - this.props = new Properties(); - props.forEach((k, v) -> this.props.put(k.toString() - .replaceAll("[-_]", "").toUpperCase(Locale.ENGLISH), v)); + this.props = props.entrySet().stream().filter(e -> format(e.getKey().toString()) + .startsWith("MYBATISPLUSJOIN.")).collect(Collectors.toMap(e -> e.getKey().toString() + .substring(e.getKey().toString().lastIndexOf(".") + 1) + .toUpperCase(Locale.ENGLISH), Map.Entry::getValue, (o, n) -> n, Properties::new)); } @SuppressWarnings("unchecked") @@ -92,5 +94,9 @@ public class XPluginImpl implements Plugin { throw new RuntimeException(e); } } + + private String format(String key) { + return key.replaceAll("[-_]", "").toUpperCase(Locale.ENGLISH); + } } } \ No newline at end of file