From 6e2ae43ea9ee8e4abd705b0d75fd5861a82c3729 Mon Sep 17 00:00:00 2001 From: chxlay Date: Mon, 9 Dec 2024 16:42:05 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AF=B9=E5=8A=A8=E6=80=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90@UseDataSource=E7=9A=84value=E5=80=BC?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=8A=A8=E6=80=81=E8=A7=A3=E6=9E=90=E5=8C=BA?= =?UTF-8?q?=E5=88=86Spring=E6=A8=A1=E5=BC=8F=E4=B8=8B=E5=92=8C=E9=9D=9ESpr?= =?UTF-8?q?ing=E6=A8=A1=E5=BC=8F=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/ParamIndexDataSourceProcessor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/datasource/processor/ParamIndexDataSourceProcessor.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/datasource/processor/ParamIndexDataSourceProcessor.java index 5dbfaec5..b944d163 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/datasource/processor/ParamIndexDataSourceProcessor.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/datasource/processor/ParamIndexDataSourceProcessor.java @@ -28,9 +28,13 @@ public class ParamIndexDataSourceProcessor implements DataSourceProcessor { if (arguments.length == 0) return null; Integer index = null; - if (INDEX_FIRST.equals(dataSourceKey)) index = 0; - if (INDEX_LAST.equals(dataSourceKey)) index = arguments.length - 1; - if (dataSourceKey.startsWith(PARAM_INDEX)) index = parseIndex(dataSourceKey); + if (INDEX_FIRST.equals(dataSourceKey)) { + index = 0; + } else if (INDEX_LAST.equals(dataSourceKey)) { + index = arguments.length - 1; + } else if (dataSourceKey.startsWith(PARAM_INDEX)) { + index = parseIndex(dataSourceKey); + } // 没有符合约定的格式输入,则会返回 null if (null == index) return null;