浏览代码

大佬说要补充点注释.

nieqiurong 7 年之前
父节点
当前提交
5508a94d9f

+ 6 - 6
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableFieldInfo.java

@@ -81,9 +81,9 @@ public class TableFieldInfo {
      */
     private FieldFill fieldFill = FieldFill.DEFAULT;
     /**
-     * todo 秋秋来把注释写上
+     * 标记该字段属于哪个类
      */
-    private Class<?> parentClass;
+    private Class<?> clazz;
 
     /**
      * <p>
@@ -91,7 +91,7 @@ public class TableFieldInfo {
      * </p>
      */
     public TableFieldInfo(boolean underCamel, GlobalConfig.DbConfig dbConfig, TableInfo tableInfo,
-                          String column, String el, Field field, TableField tableField, Class<?> parentClass) {
+                          String column, String el, Field field, TableField tableField, Class<?> clazz) {
         this.property = field.getName();
         this.propertyType = field.getType();
         /*
@@ -134,10 +134,10 @@ public class TableFieldInfo {
          * 保存当前字段的填充策略
          */
         this.fieldFill = tableField.fill();
-        this.parentClass = parentClass;
+        this.clazz = clazz;
     }
 
-    public TableFieldInfo(boolean underCamel, GlobalConfig.DbConfig dbConfig, TableInfo tableInfo, Field field, Class<?> parentClass) {
+    public TableFieldInfo(boolean underCamel, GlobalConfig.DbConfig dbConfig, TableInfo tableInfo, Field field, Class<?> clazz) {
         if (dbConfig.isColumnUnderline()) {
             /* 开启字段下划线申明 */
             this.column = StringUtils.camelToUnderline(field.getName());
@@ -153,7 +153,7 @@ public class TableFieldInfo {
         this.fieldStrategy = dbConfig.getFieldStrategy();
         this.propertyType = field.getType();
         this.setCondition(dbConfig);
-        this.parentClass = parentClass;
+        this.clazz = clazz;
         tableInfo.setLogicDelete(this.initLogicDelete(dbConfig, field));
     }
 

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

@@ -90,9 +90,9 @@ public class TableInfo {
      */
     private boolean logicDelete = false;
     /**
-     * todo 秋秋来把注释写上
+     * 标记该字段属于哪个类
      */
-    private Class<?> parentClass;
+    private Class<?> clazz;
 
     /**
      * <p>

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/LambdaUtils.java

@@ -100,14 +100,14 @@ public final class LambdaUtils {
     private static Map<String, String> createLambdaMap(TableInfo tableInfo, Class clazz) {
         Map<String, String> map = new HashMap<>(16);
         if (StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {
-            if (tableInfo.getParentClass() != clazz) {
-                saveCache(tableInfo.getParentClass().getName(), tableInfo.getKeyProperty(), tableInfo.getKeyColumn());
+            if (tableInfo.getClazz() != clazz) {
+                saveCache(tableInfo.getClazz().getName(), tableInfo.getKeyProperty(), tableInfo.getKeyColumn());
             }
             map.put(tableInfo.getKeyProperty(), tableInfo.getKeyColumn());
         }
         tableInfo.getFieldList().forEach(i -> {
-            if (i.getParentClass() != clazz) {
-                saveCache(i.getParentClass().getName(), i.getProperty(), i.getColumn());
+            if (i.getClazz() != clazz) {
+                saveCache(i.getClazz().getName(), i.getProperty(), i.getColumn());
             }
             map.put(i.getProperty(), i.getColumn());
         });

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/TableInfoHelper.java

@@ -314,7 +314,7 @@ public class TableInfoHelper {
                         column = column.toUpperCase();
                     }
                 }
-                tableInfo.setParentClass(field.getDeclaringClass());
+                tableInfo.setClazz(field.getDeclaringClass());
                 tableInfo.setKeyColumn(column);
                 tableInfo.setKeyProperty(field.getName());
                 return true;
@@ -346,7 +346,7 @@ public class TableInfoHelper {
                 tableInfo.setIdType(dbConfig.getIdType());
                 tableInfo.setKeyColumn(column);
                 tableInfo.setKeyProperty(field.getName());
-                tableInfo.setParentClass(field.getDeclaringClass());
+                tableInfo.setClazz(field.getDeclaringClass());
                 return true;
             } else {
                 throwExceptionId(clazz);