From 52c33a907a8a024ba269ae518f19d5732e33390b Mon Sep 17 00:00:00 2001 From: yulichang <570810310@qq.com> Date: Thu, 29 Dec 2022 16:35:27 +0800 Subject: [PATCH] =?UTF-8?q?mybatis=20plus=203.5.3=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=20springboot3=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...framework.boot.autoconfigure.AutoConfiguration.imports | 1 + .../mybatisplus/core/metadata/MPJTableInfoHelper.java | 8 +++++++- .../com/github/yulichang/method/MPJAbstractMethod.java | 4 ++-- .../java/com/github/yulichang/method/SelectJoinList.java | 3 ++- .../java/com/github/yulichang/method/SelectJoinMap.java | 3 ++- .../java/com/github/yulichang/method/SelectJoinMaps.java | 3 ++- .../com/github/yulichang/method/SelectJoinMapsPage.java | 3 ++- .../java/com/github/yulichang/method/SelectJoinOne.java | 3 ++- .../java/com/github/yulichang/method/SelectJoinPage.java | 3 ++- 9 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 mybatis-plus-join-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/mybatis-plus-join-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/mybatis-plus-join-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..e1c3736 --- /dev/null +++ b/mybatis-plus-join-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration \ No newline at end of file diff --git a/mybatis-plus-join-core/src/main/java/com/baomidou/mybatisplus/core/metadata/MPJTableInfoHelper.java b/mybatis-plus-join-core/src/main/java/com/baomidou/mybatisplus/core/metadata/MPJTableInfoHelper.java index d938333..dedfe5a 100644 --- a/mybatis-plus-join-core/src/main/java/com/baomidou/mybatisplus/core/metadata/MPJTableInfoHelper.java +++ b/mybatis-plus-join-core/src/main/java/com/baomidou/mybatisplus/core/metadata/MPJTableInfoHelper.java @@ -6,6 +6,7 @@ import com.github.yulichang.annotation.EntityMapping; import com.github.yulichang.annotation.FieldMapping; import com.github.yulichang.exception.MPJException; import com.github.yulichang.mapper.MPJTableInfo; +import org.apache.ibatis.session.Configuration; import java.lang.reflect.Field; import java.util.ArrayList; @@ -129,7 +130,12 @@ public class MPJTableInfoHelper { */ public static TableInfo copyAndSetTableName(TableInfo tableInfo, String tableName) { try { - TableInfo table = new TableInfo(tableInfo.getEntityType()); + TableInfo table; + try { + table = TableInfo.class.getDeclaredConstructor(Class.class).newInstance(tableInfo.getEntityType()); + } catch (Exception e) { + table = TableInfo.class.getDeclaredConstructor(Configuration.class, Class.class).newInstance(tableInfo.getConfiguration(), tableInfo.getEntityType()); + } //反射拷贝对象 Field[] fields = TableInfo.class.getDeclaredFields(); for (Field f : fields) { diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java index ae810e2..d7d79ac 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java @@ -22,9 +22,9 @@ public abstract class MPJAbstractMethod extends AbstractMethod implements MPJBas super(); } - @SuppressWarnings({"unused", "deprecation"}) + @SuppressWarnings({"unused"}) protected MPJAbstractMethod(String methodName) { - super(); + super(methodName); } /** diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinList.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinList.java index b5a3e61..6bf39fb 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinList.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinList.java @@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource; */ public class SelectJoinList extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinList() { - super(SqlMethod.SELECT_JOIN_LIST.getMethod()); + super(); } @SuppressWarnings("unused") diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMap.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMap.java index a1af0f8..a2119ed 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMap.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMap.java @@ -13,8 +13,9 @@ import java.util.Map; */ public class SelectJoinMap extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinMap() { - super(SqlMethod.SELECT_JOIN_LIST.getMethod()); + super(); } @SuppressWarnings("unused") diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMaps.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMaps.java index 7ce755c..0748e8d 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMaps.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMaps.java @@ -13,8 +13,9 @@ import java.util.Map; */ public class SelectJoinMaps extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinMaps() { - super(SqlMethod.SELECT_JOIN_MAPS.getMethod()); + super(); } @SuppressWarnings("unused") diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMapsPage.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMapsPage.java index 08bcb24..1c3214d 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMapsPage.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinMapsPage.java @@ -13,8 +13,9 @@ import java.util.Map; */ public class SelectJoinMapsPage extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinMapsPage() { - super(SqlMethod.SELECT_JOIN_MAPS_PAGE.getMethod()); + super(); } @SuppressWarnings("unused") diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinOne.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinOne.java index 16a712b..38bbd31 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinOne.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinOne.java @@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource; */ public class SelectJoinOne extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinOne() { - super(SqlMethod.SELECT_JOIN_ONE.getMethod()); + super(); } @SuppressWarnings("unused") diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinPage.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinPage.java index ac3cdcf..4d14e10 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinPage.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/SelectJoinPage.java @@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource; */ public class SelectJoinPage extends MPJAbstractMethod { + @SuppressWarnings("deprecation") public SelectJoinPage() { - super(SqlMethod.SELECT_JOIN_PAGE.getMethod()); + super(); } @SuppressWarnings("unused")