浏览代码

移除 ChooseTableField

miemie 6 年之前
父节点
当前提交
68e4eaa614

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

@@ -15,6 +15,7 @@
  */
  */
 package com.baomidou.mybatisplus.core.injector;
 package com.baomidou.mybatisplus.core.injector;
 
 
+import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
@@ -31,6 +32,13 @@ import org.apache.ibatis.mapping.StatementType;
 import org.apache.ibatis.scripting.LanguageDriver;
 import org.apache.ibatis.scripting.LanguageDriver;
 import org.apache.ibatis.session.Configuration;
 import org.apache.ibatis.session.Configuration;
 
 
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.joining;
+
 /**
 /**
  * 抽象的注入方法类
  * 抽象的注入方法类
  *
  *
@@ -205,6 +213,18 @@ public abstract class AbstractMethod implements Constants {
         }
         }
     }
     }
 
 
+    /**
+     * 过滤 TableFieldInfo 集合, join 成字符串
+     */
+    protected String filterTableFieldInfo(List<TableFieldInfo> fieldList, Predicate<TableFieldInfo> predicate,
+                                          Function<TableFieldInfo, String> function, String joiningVal) {
+        Stream<TableFieldInfo> infoStream = fieldList.stream();
+        if (predicate != null) {
+            return infoStream.filter(predicate).map(function).collect(joining(joiningVal));
+        }
+        return infoStream.map(function).collect(joining(joiningVal));
+    }
+
     protected String optlockVersion() {
     protected String optlockVersion() {
         return "<if test=\"et instanceof java.util.Map\">" +
         return "<if test=\"et instanceof java.util.Map\">" +
             " AND ${et." + Constants.MP_OPTLOCK_VERSION_COLUMN +
             " AND ${et." + Constants.MP_OPTLOCK_VERSION_COLUMN +

+ 0 - 62
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/ChooseTableField.java

@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2011-2019, hubin (jobob@qq.com).
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p>
- * https://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.baomidou.mybatisplus.core.injector;
-
-import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-
-/**
- * 带有进行字段筛选功能
- *
- * @author miemie
- * @since 2019-04-12
- */
-public abstract class ChooseTableField<Children> extends AbstractMethod {
-
-    /**
-     * 筛选条件集合
-     */
-    private List<Predicate<TableFieldInfo>> predicates = new ArrayList<>();
-
-    /**
-     * 设置字段删选函数
-     * <p> 注意: 推荐设置的函数是: <strong>过滤掉</strong>不要的字段 </p>
-     *
-     * @param predicate 函数
-     */
-    @SuppressWarnings("unchecked")
-    public Children addPredicate(Predicate<TableFieldInfo> predicate) {
-        Assert.notNull(predicate, "this predicate can not be null !");
-        this.predicates.add(predicate);
-        return (Children) this;
-    }
-
-    /**
-     * 进行字段筛选
-     */
-    protected Stream<TableFieldInfo> filters(List<TableFieldInfo> fieldInfos) {
-        Stream<TableFieldInfo> stream = fieldInfos.stream();
-        for (Predicate<TableFieldInfo> predicate : predicates) {
-            stream = stream.filter(predicate);
-        }
-        return stream;
-    }
-}

+ 26 - 8
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/injector/methods/additional/AlwaysUpdateSomeColumnById.java

@@ -16,13 +16,18 @@
 package com.baomidou.mybatisplus.extension.injector.methods.additional;
 package com.baomidou.mybatisplus.extension.injector.methods.additional;
 
 
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
-import com.baomidou.mybatisplus.core.injector.ChooseTableField;
+import com.baomidou.mybatisplus.core.injector.AbstractMethod;
+import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
 import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.mapping.MappedStatement;
 import org.apache.ibatis.mapping.SqlSource;
 import org.apache.ibatis.mapping.SqlSource;
 
 
-import static java.util.stream.Collectors.joining;
+import java.util.function.Predicate;
 
 
 /**
 /**
  * 根据 ID 更新固定的那几个字段(但是不包含逻辑删除)
  * 根据 ID 更新固定的那几个字段(但是不包含逻辑删除)
@@ -39,27 +44,40 @@ import static java.util.stream.Collectors.joining;
  * @author hubin
  * @author hubin
  * @since 2019-04-12
  * @since 2019-04-12
  */
  */
-public class AlwaysUpdateSomeColumnById extends ChooseTableField<AlwaysUpdateSomeColumnById> {
+@NoArgsConstructor
+@AllArgsConstructor
+public class AlwaysUpdateSomeColumnById extends AbstractMethod {
 
 
     /**
     /**
      * mapper 对应的方法名
      * mapper 对应的方法名
      */
      */
     private static final String MAPPER_METHOD = "alwaysUpdateSomeColumnById";
     private static final String MAPPER_METHOD = "alwaysUpdateSomeColumnById";
 
 
-    public AlwaysUpdateSomeColumnById() {
-        this.addPredicate(t -> !t.isLogicDelete());
-    }
+    /**
+     * 字段筛选条件
+     */
+    @Setter
+    @Accessors(chain = true)
+    private Predicate<TableFieldInfo> predicate;
 
 
     @Override
     @Override
     public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
     public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
         SqlMethod sqlMethod = SqlMethod.UPDATE_BY_ID;
         SqlMethod sqlMethod = SqlMethod.UPDATE_BY_ID;
         final String additional = optlockVersion() + tableInfo.getLogicDeleteSql(true, false);
         final String additional = optlockVersion() + tableInfo.getLogicDeleteSql(true, false);
-        String sqlSet = this.filters(tableInfo.getFieldList())
-            .map(i -> i.getSqlSet(true, ENTITY_DOT)).collect(joining(NEWLINE));
+        String sqlSet = this.filterTableFieldInfo(tableInfo.getFieldList(), getPredicate(),
+            i -> i.getSqlSet(true, ENTITY_DOT), NEWLINE);
         sqlSet = SqlScriptUtils.convertSet(sqlSet);
         sqlSet = SqlScriptUtils.convertSet(sqlSet);
         String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), sqlSet,
         String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), sqlSet,
             tableInfo.getKeyColumn(), ENTITY_DOT + tableInfo.getKeyProperty(), additional);
             tableInfo.getKeyColumn(), ENTITY_DOT + tableInfo.getKeyProperty(), additional);
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         return addUpdateMappedStatement(mapperClass, modelClass, MAPPER_METHOD, sqlSource);
         return addUpdateMappedStatement(mapperClass, modelClass, MAPPER_METHOD, sqlSource);
     }
     }
+
+    private Predicate<TableFieldInfo> getPredicate() {
+        Predicate<TableFieldInfo> noLogic = t -> !t.isLogicDelete();
+        if (predicate != null) {
+            return noLogic.and(predicate);
+        }
+        return noLogic;
+    }
 }
 }

+ 15 - 14
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/injector/methods/additional/InsertBatchSomeColumn.java

@@ -17,13 +17,16 @@ package com.baomidou.mybatisplus.extension.injector.methods.additional;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
-import com.baomidou.mybatisplus.core.injector.ChooseTableField;
+import com.baomidou.mybatisplus.core.injector.AbstractMethod;
 import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
 import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.TableInfoHelper;
 import com.baomidou.mybatisplus.core.toolkit.TableInfoHelper;
 import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
 import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
+import lombok.AllArgsConstructor;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
 import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
 import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
 import org.apache.ibatis.executor.keygen.KeyGenerator;
 import org.apache.ibatis.executor.keygen.KeyGenerator;
 import org.apache.ibatis.executor.keygen.NoKeyGenerator;
 import org.apache.ibatis.executor.keygen.NoKeyGenerator;
@@ -33,8 +36,6 @@ import org.apache.ibatis.mapping.SqlSource;
 import java.util.List;
 import java.util.List;
 import java.util.function.Predicate;
 import java.util.function.Predicate;
 
 
-import static java.util.stream.Collectors.joining;
-
 /**
 /**
  * 批量新增数据,自选字段 insert
  * 批量新增数据,自选字段 insert
  * <p> 不同的数据库支持度不一样!!!  只在 mysql 下测试过!!!  只在 mysql 下测试过!!!  只在 mysql 下测试过!!! </p>
  * <p> 不同的数据库支持度不一样!!!  只在 mysql 下测试过!!!  只在 mysql 下测试过!!!  只在 mysql 下测试过!!! </p>
@@ -61,7 +62,8 @@ import static java.util.stream.Collectors.joining;
  * @since 2018-11-29
  * @since 2018-11-29
  */
  */
 @NoArgsConstructor
 @NoArgsConstructor
-public class InsertBatchSomeColumn extends ChooseTableField<InsertBatchSomeColumn> {
+@AllArgsConstructor
+public class InsertBatchSomeColumn extends AbstractMethod {
 
 
     /**
     /**
      * mapper 对应的方法名
      * mapper 对应的方法名
@@ -69,12 +71,11 @@ public class InsertBatchSomeColumn extends ChooseTableField<InsertBatchSomeColum
     private static final String MAPPER_METHOD = "insertBatchSomeColumn";
     private static final String MAPPER_METHOD = "insertBatchSomeColumn";
 
 
     /**
     /**
-     * @deprecated please to use {@link #addPredicate(Predicate)}
+     * 字段筛选条件
      */
      */
-    @Deprecated
-    public InsertBatchSomeColumn(Predicate<TableFieldInfo> predicate) {
-        this.addPredicate(predicate);
-    }
+    @Setter
+    @Accessors(chain = true)
+    private Predicate<TableFieldInfo> predicate;
 
 
     @SuppressWarnings("Duplicates")
     @SuppressWarnings("Duplicates")
     @Override
     @Override
@@ -82,11 +83,11 @@ public class InsertBatchSomeColumn extends ChooseTableField<InsertBatchSomeColum
         KeyGenerator keyGenerator = new NoKeyGenerator();
         KeyGenerator keyGenerator = new NoKeyGenerator();
         SqlMethod sqlMethod = SqlMethod.INSERT_ONE;
         SqlMethod sqlMethod = SqlMethod.INSERT_ONE;
         List<TableFieldInfo> fieldList = tableInfo.getFieldList();
         List<TableFieldInfo> fieldList = tableInfo.getFieldList();
-        String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(false) + this.filters(fieldList)
-            .map(TableFieldInfo::getInsertSqlColumn).collect(joining(EMPTY));
+        String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(false) +
+            this.filterTableFieldInfo(fieldList, predicate, TableFieldInfo::getInsertSqlColumn, EMPTY);
         String columnScript = LEFT_BRACKET + insertSqlColumn.substring(0, insertSqlColumn.length() - 1) + RIGHT_BRACKET;
         String columnScript = LEFT_BRACKET + insertSqlColumn.substring(0, insertSqlColumn.length() - 1) + RIGHT_BRACKET;
-        String insertSqlProperty = tableInfo.getKeyInsertSqlProperty(ENTITY_DOT, false) + this.filters(fieldList)
-            .map(i -> i.getInsertSqlProperty(ENTITY_DOT)).collect(joining(EMPTY));
+        String insertSqlProperty = tableInfo.getKeyInsertSqlProperty(ENTITY_DOT, false) +
+            this.filterTableFieldInfo(fieldList, predicate, i -> i.getInsertSqlProperty(ENTITY_DOT), EMPTY);
         insertSqlProperty = LEFT_BRACKET + insertSqlProperty.substring(0, insertSqlProperty.length() - 1) + RIGHT_BRACKET;
         insertSqlProperty = LEFT_BRACKET + insertSqlProperty.substring(0, insertSqlProperty.length() - 1) + RIGHT_BRACKET;
         String valuesScript = SqlScriptUtils.convertForeach(insertSqlProperty, "list", null, ENTITY, COMMA);
         String valuesScript = SqlScriptUtils.convertForeach(insertSqlProperty, "list", null, ENTITY, COMMA);
         String keyProperty = null;
         String keyProperty = null;
@@ -94,7 +95,7 @@ public class InsertBatchSomeColumn extends ChooseTableField<InsertBatchSomeColum
         // 表包含主键处理逻辑,如果不包含主键当普通字段处理
         // 表包含主键处理逻辑,如果不包含主键当普通字段处理
         if (StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {
         if (StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {
             if (tableInfo.getIdType() == IdType.AUTO) {
             if (tableInfo.getIdType() == IdType.AUTO) {
-                /** 自增主键 */
+                /* 自增主键 */
                 keyGenerator = new Jdbc3KeyGenerator();
                 keyGenerator = new Jdbc3KeyGenerator();
                 keyProperty = tableInfo.getKeyProperty();
                 keyProperty = tableInfo.getKeyProperty();
                 keyColumn = tableInfo.getKeyColumn();
                 keyColumn = tableInfo.getKeyColumn();

+ 16 - 3
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/base/BaseDbTest.java

@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.test.base.entity.CommonLogicData;
 import com.baomidou.mybatisplus.test.base.entity.ResultMapEntity;
 import com.baomidou.mybatisplus.test.base.entity.ResultMapEntity;
 import com.baomidou.mybatisplus.test.base.enums.TestEnum;
 import com.baomidou.mybatisplus.test.base.enums.TestEnum;
 import com.baomidou.mybatisplus.test.base.mapper.children.CommonDataChildrenMapper;
 import com.baomidou.mybatisplus.test.base.mapper.children.CommonDataChildrenMapper;
+import com.baomidou.mybatisplus.test.base.mapper.children.CommonLogicDataChildrenMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonDataCopyMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonDataCopyMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonDataMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonDataMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonLogicDataMapper;
 import com.baomidou.mybatisplus.test.base.mapper.commons.CommonLogicDataMapper;
@@ -66,11 +67,13 @@ public abstract class BaseDbTest {
     protected CommonDataMapper commonDataMapper;
     protected CommonDataMapper commonDataMapper;
     @Resource(name = "commonDataChildrenMapper")
     @Resource(name = "commonDataChildrenMapper")
     protected CommonDataChildrenMapper commonDataChildrenMapper;
     protected CommonDataChildrenMapper commonDataChildrenMapper;
+    @Resource(name = "commonLogicDataMapper")
+    protected CommonLogicDataMapper commonLogicDataMapper;
+    @Resource(name = "commonLogicDataChildrenMapper")
+    protected CommonLogicDataChildrenMapper commonLogicDataChildrenMapper;
     @Resource
     @Resource
     protected CommonDataCopyMapper commonDataCopyMapper;
     protected CommonDataCopyMapper commonDataCopyMapper;
     @Resource
     @Resource
-    protected CommonLogicDataMapper commonLogicDataMapper;
-    @Resource
     protected ResultMapEntityMapper resultMapEntityMapper;
     protected ResultMapEntityMapper resultMapEntityMapper;
     @Autowired
     @Autowired
     private SqlSessionFactory sqlSessionFactory;
     private SqlSessionFactory sqlSessionFactory;
@@ -213,7 +216,6 @@ public abstract class BaseDbTest {
         assertNotNull(commonDataMapper.selectById(id).getTestEnum());
         assertNotNull(commonDataMapper.selectById(id).getTestEnum());
         // todo
         // todo
         assertTrue(commonDataMapper.getById(id).isPresent());
         assertTrue(commonDataMapper.getById(id).isPresent());
-        assertThat(commonDataChildrenMapper.getByIdChildren(id).isPresent()).isTrue();
         assertThat(commonDataCopyMapper.selectById(id).isPresent()).isTrue();
         assertThat(commonDataCopyMapper.selectById(id).isPresent()).isTrue();
         assertNotNull(commonLogicDataMapper.selectById(id));
         assertNotNull(commonLogicDataMapper.selectById(id));
         ResultMapEntity resultMapEntity = resultMapEntityMapper.selectById(id);
         ResultMapEntity resultMapEntity = resultMapEntityMapper.selectById(id);
@@ -345,4 +347,15 @@ public abstract class BaseDbTest {
     }
     }
 
 
     protected abstract void selectPage();
     protected abstract void selectPage();
+
+    @Test
+    void a17_fatherAndChildren() {
+        long id = 6;
+        assertThat(commonDataMapper.getById(id).isPresent()).isTrue();
+        assertThat(commonDataChildrenMapper.getByIdChildren(id).isPresent()).isTrue();
+        assertNotNull(commonLogicDataMapper.selectById(id));
+        assertNotNull(commonLogicDataChildrenMapper.selectById(id));
+        commonLogicDataMapper.getByWrapper(Wrappers.lambdaQuery());
+        commonLogicDataChildrenMapper.getByWrapper(Wrappers.lambdaQuery());
+    }
 }
 }

+ 35 - 0
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/base/mapper/children/CommonLogicDataChildrenMapper.java

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011-2019, hubin (jobob@qq.com).
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.baomidou.mybatisplus.test.base.mapper.children;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.test.base.entity.CommonLogicData;
+import com.baomidou.mybatisplus.test.base.mapper.commons.CommonLogicDataMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+/**
+ * @author miemie
+ * @since 2018-07-06
+ */
+public interface CommonLogicDataChildrenMapper extends CommonLogicDataMapper {
+
+    @Select("select id,test_int from common_logic_data ${ew.customSqlSegment}")
+    List<CommonLogicData> getByWrapper(@Param(Constants.WRAPPER) LambdaQueryWrapper wrapper);
+}

+ 1 - 2
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/h2/config/MybatisPlusConfig.java

@@ -119,8 +119,7 @@ public class MybatisPlusConfig {
             public List<AbstractMethod> getMethodList() {
             public List<AbstractMethod> getMethodList() {
                 List<AbstractMethod> methodList = super.getMethodList();
                 List<AbstractMethod> methodList = super.getMethodList();
                 methodList.add(new LogicDeleteByIdWithFill());
                 methodList.add(new LogicDeleteByIdWithFill());
-                methodList.add(new AlwaysUpdateSomeColumnById()
-                    .addPredicate(t -> t.getFieldFill() != FieldFill.INSERT));
+                methodList.add(new AlwaysUpdateSomeColumnById(t -> t.getFieldFill() != FieldFill.INSERT));
                 methodList.add(new InsertBatchSomeColumn(t -> !(t.getFieldFill() == FieldFill.UPDATE
                 methodList.add(new InsertBatchSomeColumn(t -> !(t.getFieldFill() == FieldFill.UPDATE
                     || t.isLogicDelete() || t.getProperty().equals("version"))));
                     || t.isLogicDelete() || t.getProperty().equals("version"))));
                 return methodList;
                 return methodList;

+ 4 - 12
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/mysql/config/MybatisPlusConfig.java

@@ -93,18 +93,10 @@ public class MybatisPlusConfig {
             public List<AbstractMethod> getMethodList() {
             public List<AbstractMethod> getMethodList() {
                 List<AbstractMethod> methodList = super.getMethodList();
                 List<AbstractMethod> methodList = super.getMethodList();
                 methodList.add(new LogicDeleteByIdWithFill());
                 methodList.add(new LogicDeleteByIdWithFill());
-                methodList.add(new InsertBatchSomeColumn()
-                    // 不要逻辑删除字段
-                    .addPredicate(t -> !t.isLogicDelete())
-                    // 不要乐观锁字段
-                    .addPredicate(t -> !t.isVersion())
-                    // 不要填充策略是 UPDATE 的字段
-                    .addPredicate(t -> t.getFieldFill() != FieldFill.UPDATE));
-                methodList.add(new AlwaysUpdateSomeColumnById()
-                    // 不要填充策略是 INSERT 的字段
-                    .addPredicate(t -> t.getFieldFill() != FieldFill.INSERT)
-                    // 不要字段名是 column4 的字段
-                    .addPredicate(t -> !t.getProperty().equals("column4")));
+                // 不要逻辑删除字段, 不要乐观锁字段, 不要填充策略是 UPDATE 的字段
+                methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete() && !t.isVersion() && t.getFieldFill() != FieldFill.UPDATE));
+                // 不要填充策略是 INSERT 的字段, 不要字段名是 column4 的字段
+                methodList.add(new AlwaysUpdateSomeColumnById(t -> t.getFieldFill() != FieldFill.INSERT && !t.getProperty().equals("column4")));
                 return methodList;
                 return methodList;
             }
             }
         };
         };