mybatis plus 3.5.3 测试以及 springboot3适配

This commit is contained in:
yulichang 2022-12-29 16:35:27 +08:00
parent 5d109b0aa1
commit 52c33a907a
9 changed files with 22 additions and 9 deletions

View File

@ -0,0 +1 @@
com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration

View File

@ -6,6 +6,7 @@ import com.github.yulichang.annotation.EntityMapping;
import com.github.yulichang.annotation.FieldMapping; import com.github.yulichang.annotation.FieldMapping;
import com.github.yulichang.exception.MPJException; import com.github.yulichang.exception.MPJException;
import com.github.yulichang.mapper.MPJTableInfo; import com.github.yulichang.mapper.MPJTableInfo;
import org.apache.ibatis.session.Configuration;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
@ -129,7 +130,12 @@ public class MPJTableInfoHelper {
*/ */
public static TableInfo copyAndSetTableName(TableInfo tableInfo, String tableName) { public static TableInfo copyAndSetTableName(TableInfo tableInfo, String tableName) {
try { 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(); Field[] fields = TableInfo.class.getDeclaredFields();
for (Field f : fields) { for (Field f : fields) {

View File

@ -22,9 +22,9 @@ public abstract class MPJAbstractMethod extends AbstractMethod implements MPJBas
super(); super();
} }
@SuppressWarnings({"unused", "deprecation"}) @SuppressWarnings({"unused"})
protected MPJAbstractMethod(String methodName) { protected MPJAbstractMethod(String methodName) {
super(); super(methodName);
} }
/** /**

View File

@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource;
*/ */
public class SelectJoinList extends MPJAbstractMethod { public class SelectJoinList extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinList() { public SelectJoinList() {
super(SqlMethod.SELECT_JOIN_LIST.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -13,8 +13,9 @@ import java.util.Map;
*/ */
public class SelectJoinMap extends MPJAbstractMethod { public class SelectJoinMap extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinMap() { public SelectJoinMap() {
super(SqlMethod.SELECT_JOIN_LIST.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -13,8 +13,9 @@ import java.util.Map;
*/ */
public class SelectJoinMaps extends MPJAbstractMethod { public class SelectJoinMaps extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinMaps() { public SelectJoinMaps() {
super(SqlMethod.SELECT_JOIN_MAPS.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -13,8 +13,9 @@ import java.util.Map;
*/ */
public class SelectJoinMapsPage extends MPJAbstractMethod { public class SelectJoinMapsPage extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinMapsPage() { public SelectJoinMapsPage() {
super(SqlMethod.SELECT_JOIN_MAPS_PAGE.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource;
*/ */
public class SelectJoinOne extends MPJAbstractMethod { public class SelectJoinOne extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinOne() { public SelectJoinOne() {
super(SqlMethod.SELECT_JOIN_ONE.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -11,8 +11,9 @@ import org.apache.ibatis.mapping.SqlSource;
*/ */
public class SelectJoinPage extends MPJAbstractMethod { public class SelectJoinPage extends MPJAbstractMethod {
@SuppressWarnings("deprecation")
public SelectJoinPage() { public SelectJoinPage() {
super(SqlMethod.SELECT_JOIN_PAGE.getMethod()); super();
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")