Pārlūkot izejas kodu

移除`TableInfo`过时方法

miemie 2 gadi atpakaļ
vecāks
revīzija
e823a98144

+ 1 - 23
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java

@@ -28,7 +28,6 @@ import org.apache.ibatis.mapping.ResultFlag;
 import org.apache.ibatis.mapping.ResultMap;
 import org.apache.ibatis.mapping.ResultMapping;
 import org.apache.ibatis.reflection.Reflector;
-import org.apache.ibatis.reflection.SystemMetaObject;
 import org.apache.ibatis.session.Configuration;
 
 import java.lang.reflect.Constructor;
@@ -102,6 +101,7 @@ public class TableInfo implements Constants {
      * MybatisConfiguration 标记 (Configuration内存地址值)
      */
     @Getter
+    @Setter(AccessLevel.NONE)
     private Configuration configuration;
     /**
      * 是否开启下划线转驼峰
@@ -182,16 +182,6 @@ public class TableInfo implements Constants {
     @Getter
     private Reflector reflector;
 
-    /**
-     * @param entityType 实体类型
-     * @deprecated 3.4.4 {@link #TableInfo(Configuration, Class)}
-     */
-    @Deprecated
-    public TableInfo(Class<?> entityType) {
-        this.entityType = entityType;
-        this.reflector = SystemMetaObject.NULL_META_OBJECT.getReflectorFactory().findForClass(entityType);
-    }
-
     /**
      * @param configuration 配置对象
      * @param entityType    实体类型
@@ -216,18 +206,6 @@ public class TableInfo implements Constants {
         return currentNamespace + DOT + sqlMethod;
     }
 
-    /**
-     * @deprecated 3.4.4 {@link #TableInfo(Configuration, Class)}
-     * 设置 Configuration
-     */
-    @Deprecated
-    void setConfiguration(Configuration configuration) {
-        Assert.notNull(configuration, "Error: You need Initialize MybatisConfiguration !");
-        this.configuration = configuration;
-        this.underCamel = configuration.isMapUnderscoreToCamelCase();
-        this.reflector = configuration.getReflectorFactory().findForClass(this.entityType);
-    }
-
     /**
      * 是否有主键
      *

+ 1 - 4
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/metadata/TableInfoTest.java

@@ -21,13 +21,10 @@ public class TableInfoTest {
         TableInfo tableInfo;
         Configuration configuration = new Configuration();
         configuration.setMapUnderscoreToCamelCase(true);
-        tableInfo = new TableInfo(Demo.class);
+        tableInfo = new TableInfo(configuration, Demo.class);
         Demo demo = tableInfo.newInstance();
         tableInfo.setPropertyValue(demo, "name", "test");
         assertThat(tableInfo.getPropertyValue(demo, "name")).isEqualTo("test");
-        assertThat(tableInfo.isUnderCamel()).isFalse();
-        assertThat(tableInfo.getReflector()).isNotNull();
-        tableInfo.setConfiguration(configuration);
         assertThat(tableInfo.isUnderCamel()).isTrue();
         assertThat(tableInfo.getReflector()).isNotNull();
         tableInfo = new TableInfo(configuration, Object.class);

+ 1 - 1
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/plugins/inner/DynamicTableNameInnerInterceptorTest.java

@@ -45,6 +45,6 @@ class DynamicTableNameInnerInterceptorTest {
 
         // 别名被声明要替换
         origin = "SELECT t.* FROM t_user_real t left join entity e on e.id = t.id";
-        assertEquals("SELECT t.* FROM t_user_real_r t left join entity e on e.id = t.id", interceptor.changeTable(origin));
+        assertEquals("SELECT t.* FROM t_user_real_r t left join entity_r e on e.id = t.id", interceptor.changeTable(origin));
     }
 }

+ 0 - 3
mybatis-plus/build.gradle

@@ -1,9 +1,6 @@
-apply plugin: 'kotlin'
-
 dependencies {
     api project(":mybatis-plus-extension")
 
-    testImplementation "${lib."kotlin-stdlib-jdk8"}"
     testImplementation "${lib.'spring-web'}"
     testImplementation "${lib.'javax.servlet-api'}"