diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java index 867a5ed7..81337ca7 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java @@ -123,10 +123,10 @@ public MPJLambdaWrapper(T entity, String alias) { * 不建议直接 new 该实例,使用 JoinWrappers.lambda(UserDO.class) */ protected MPJLambdaWrapper(T entity, Class entityClass, SharedString sqlSelect, AtomicInteger paramNameSeq, - Map paramNameValuePairs, MergeSegments mergeSegments, SharedString paramAlias, - SharedString lastSql, SharedString sqlComment, SharedString sqlFirst, - TableList tableList, Integer index, String keyWord, Class joinClass, String tableName, - BiPredicate IfExists) { + Map paramNameValuePairs, MergeSegments mergeSegments, SharedString paramAlias, + SharedString lastSql, SharedString sqlComment, SharedString sqlFirst, + TableList tableList, Integer index, String keyWord, Class joinClass, String tableName, + BiPredicate IfExists) { super.setEntity(entity); super.setEntityClass(entityClass); this.paramNameSeq = paramNameSeq; @@ -197,6 +197,30 @@ public MPJLambdaWrapper selectAll(Class clazz) { return Query.super.selectAll(clazz); } + /** + * 查询实体类全部字段 + * + * @param clazz 查询的实体类 + * @param exclude 排除字段 + */ + @Override + @SafeVarargs + public final MPJLambdaWrapper selectAll(Class clazz, SFunction... exclude) { + return Query.super.selectAll(clazz, exclude); + } + + /** + * 查询实体类全部字段 + * + * @param clazz 查询的实体类 + * @param exclude 排除字段 + */ + @Override + @SafeVarargs + public final MPJLambdaWrapper selectAll(Class clazz, String prefix, SFunction... exclude) { + return Query.super.selectAll(clazz, prefix, exclude); + } + /** * 查询主表全部字段 *

diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/interfaces/Query.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/interfaces/Query.java index b096944a..03b531bd 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/interfaces/Query.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/interfaces/Query.java @@ -16,8 +16,7 @@ import com.github.yulichang.wrapper.segments.*; import java.io.Serializable; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -173,6 +172,38 @@ default Children selectAll(Class clazz, String prefix) { return getChildren(); } + /** + * 查询实体类全部字段 + * + * @param clazz 查询的实体类 + * @param exclude 排除字段 + */ + @SuppressWarnings("unchecked") + default Children selectAll(Class clazz, SFunction... exclude) { + Set excludeSet = Arrays.stream(exclude).map(i -> + LambdaUtils.getName(i).toUpperCase(Locale.ENGLISH)).collect(Collectors.toSet()); + getSelectColum().addAll(ColumnCache.getListField(clazz).stream().filter(e -> + !excludeSet.contains(e.getColumProperty().toUpperCase(Locale.ENGLISH))).map(i -> + new SelectNormal(i, getIndex(), isHasAlias(), getAlias())).collect(Collectors.toList())); + return getChildren(); + } + + /** + * 查询实体类全部字段 + * + * @param clazz 查询的实体类 + * @param exclude 排除字段 + */ + @SuppressWarnings("unchecked") + default Children selectAll(Class clazz, String prefix, SFunction... exclude) { + Set excludeSet = Arrays.stream(exclude).map(i -> + LambdaUtils.getName(i).toUpperCase(Locale.ENGLISH)).collect(Collectors.toSet()); + getSelectColum().addAll(ColumnCache.getListField(clazz).stream().filter(e -> + !excludeSet.contains(e.getColumProperty().toUpperCase(Locale.ENGLISH))).map(e -> + new SelectNormal(e, getIndex(), true, prefix)).collect(Collectors.toList())); + return getChildren(); + } + /** * select sql 片段 */