Browse Source

TableInfo

miemie 5 năm trước cách đây
mục cha
commit
e7afee65fb

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/AbstractMethod.java

@@ -237,7 +237,7 @@ public abstract class AbstractMethod implements Constants {
     }
 
     protected String optlockVersion(TableInfo tableInfo) {
-        if (tableInfo.isEnableVersion()) {
+        if (tableInfo.isWithVersion()) {
             return "<if test=\"oli != null\">" +
                 " AND ${oli." + Constants.MP_OPTLOCK_VERSION_COLUMN +
                 "}=#{oli." + Constants.MP_OPTLOCK_VERSION_ORIGINAL + StringPool.RIGHT_BRACE +

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

@@ -151,9 +151,9 @@ public class TableInfo implements Constants {
      */
     @Getter
     @Setter(AccessLevel.NONE)
-    private boolean enableVersion;
+    private boolean withVersion;
     /**
-     * 表字段是否启用了乐观锁
+     * 乐观锁字段
      *
      * @since 3.3.1
      */
@@ -423,7 +423,7 @@ public class TableInfo implements Constants {
                 this.withUpdateFill = true;
             }
             if (i.isVersion()) {
-                this.enableVersion = true;
+                this.withVersion = true;
                 this.versionFieldInfo = i;
             }
         });

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/OptimisticLockerInterceptor.java

@@ -80,7 +80,7 @@ public class OptimisticLockerInterceptor implements Interceptor {
                 String methodName = methodId.substring(methodId.lastIndexOf(StringPool.DOT) + 1);
                 Class<?> entityClass = et.getClass();
                 TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
-                if (tableInfo == null || !tableInfo.isEnableVersion()) {
+                if (tableInfo == null || !tableInfo.isWithVersion()) {
                     return invocation.proceed();
                 }
                 TableFieldInfo fieldInfo = tableInfo.getVersionFieldInfo();