mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
添加子查询
This commit is contained in:
parent
0a05f48032
commit
b4ce33141d
@ -1,15 +0,0 @@
|
|||||||
### 当前使用版本(必填,否则不予处理)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 该问题是如何引起的?(确定最新版也有问题再提!!!)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 重现步骤(如果有就写完整)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 报错信息
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
### 该Pull Request关联的Issue
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 修改描述
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 测试用例
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 修复效果的截屏
|
|
||||||
|
|
||||||
|
|
@ -4,10 +4,13 @@ import java.lang.annotation.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表名注解
|
* 动态表名注解
|
||||||
|
* <p>
|
||||||
|
* 1.5.2及以后无需添加此注解就可实现动态表名
|
||||||
*
|
*
|
||||||
* @author yulichang
|
* @author yulichang
|
||||||
* @since 1.4.4
|
* @since 1.4.4
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
|
@ -33,7 +33,7 @@ public class FuncArgs {
|
|||||||
|
|
||||||
public SelectFunc.Arg[] getFuncArg() {
|
public SelectFunc.Arg[] getFuncArg() {
|
||||||
return Arrays.stream(args).map(i ->
|
return Arrays.stream(args).map(i ->
|
||||||
new SelectFunc.Arg(KtUtils.ref(i), i.getName(), false, null, i))
|
new SelectFunc.Arg(KtUtils.ref(i), i.getName(), false, null, i,false,null))
|
||||||
.toArray(SelectFunc.Arg[]::new);
|
.toArray(SelectFunc.Arg[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||||
import com.github.yulichang.adapter.AdapterHelper;
|
import com.github.yulichang.adapter.AdapterHelper;
|
||||||
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
||||||
import com.github.yulichang.annotation.DynamicTableName;
|
|
||||||
import com.github.yulichang.config.ConfigProperties;
|
import com.github.yulichang.config.ConfigProperties;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@ -123,6 +122,7 @@ public interface MPJBaseMethod extends Constants {
|
|||||||
tableFieldInfo.getWhereStrategy());
|
tableFieldInfo.getWhereStrategy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"DuplicatedCode", "deprecation"})
|
||||||
default String convertIf(TableFieldInfo tableFieldInfo, final String sqlScript, final String property, final FieldStrategy fieldStrategy) {
|
default String convertIf(TableFieldInfo tableFieldInfo, final String sqlScript, final String property, final FieldStrategy fieldStrategy) {
|
||||||
if (fieldStrategy == FieldStrategy.NEVER) {
|
if (fieldStrategy == FieldStrategy.NEVER) {
|
||||||
return null;
|
return null;
|
||||||
@ -183,10 +183,6 @@ public interface MPJBaseMethod extends Constants {
|
|||||||
* 获取表名
|
* 获取表名
|
||||||
*/
|
*/
|
||||||
default String mpjTableName(TableInfo tableInfo) {
|
default String mpjTableName(TableInfo tableInfo) {
|
||||||
DynamicTableName dynamicTableName = tableInfo.getEntityType().getAnnotation(DynamicTableName.class);
|
|
||||||
if (Objects.isNull(dynamicTableName)) {
|
|
||||||
return tableInfo.getTableName();
|
|
||||||
}
|
|
||||||
String tableName = tableInfo.getTableName(), encode;
|
String tableName = tableInfo.getTableName(), encode;
|
||||||
try {
|
try {
|
||||||
encode = URLEncoder.encode(tableName, "UTF-8");
|
encode = URLEncoder.encode(tableName, "UTF-8");
|
||||||
|
@ -302,11 +302,9 @@ public class MPJLambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, MPJLambda
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表名
|
* 动态表名
|
||||||
* 如果主表需要动态表名,主表实体必须添加 @DynamicTableName 注解
|
|
||||||
* 关联表则不需要 加不加注解都会生效
|
|
||||||
* <p>
|
* <p>
|
||||||
*
|
* 如果主表需要动态表名
|
||||||
* @see com.github.yulichang.annotation.DynamicTableName
|
* <p>
|
||||||
*/
|
*/
|
||||||
public MPJLambdaQueryWrapper<T> setTableName(Function<String, String> func) {
|
public MPJLambdaQueryWrapper<T> setTableName(Function<String, String> func) {
|
||||||
this.tableNameFunc = func;
|
this.tableNameFunc = func;
|
||||||
|
@ -314,11 +314,9 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表名
|
* 动态表名
|
||||||
* 如果主表需要动态表名,主表实体必须添加 @DynamicTableName 注解
|
|
||||||
* 关联表则不需要 加不加注解都会生效
|
|
||||||
* <p>
|
* <p>
|
||||||
*
|
* 如果主表需要动态表名
|
||||||
* @see com.github.yulichang.annotation.DynamicTableName
|
* <p>
|
||||||
*/
|
*/
|
||||||
public MPJQueryWrapper<T> setTableName(Function<String, String> func) {
|
public MPJQueryWrapper<T> setTableName(Function<String, String> func) {
|
||||||
this.tableNameFunc = func;
|
this.tableNameFunc = func;
|
||||||
|
@ -20,36 +20,7 @@ import java.util.Optional;
|
|||||||
public class WrapperUtils {
|
public class WrapperUtils {
|
||||||
|
|
||||||
public static <T> String buildSubSqlByWrapper(Class<T> clazz, MPJLambdaWrapper<T> wrapper, String alias) {
|
public static <T> String buildSubSqlByWrapper(Class<T> clazz, MPJLambdaWrapper<T> wrapper, String alias) {
|
||||||
TableInfo tableInfo = TableHelper.getAssert(clazz);
|
return String.format("%s AS %s", buildUnionSqlByWrapper(clazz, wrapper), alias);
|
||||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
|
||||||
boolean hasWhere = false;
|
|
||||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
|
||||||
if (StringUtils.isNotBlank(entityWhere)) {
|
|
||||||
hasWhere = true;
|
|
||||||
}
|
|
||||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
|
||||||
if (StringUtils.isNotBlank(mainLogic)) {
|
|
||||||
hasWhere = true;
|
|
||||||
}
|
|
||||||
String subLogic = subLogic(hasWhere, wrapper);
|
|
||||||
if (StringUtils.isNotBlank(subLogic)) {
|
|
||||||
hasWhere = true;
|
|
||||||
}
|
|
||||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
|
||||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
|
||||||
|
|
||||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
|
||||||
return String.format(" (%s SELECT %s FROM %s %s %s %s %s %s %s) AS %s ",
|
|
||||||
first,
|
|
||||||
wrapper.getSqlSelect(),
|
|
||||||
wrapper.getTableName(tableInfo.getTableName()),
|
|
||||||
wrapper.getAlias(),
|
|
||||||
wrapper.getFrom(),
|
|
||||||
mainLogic,
|
|
||||||
subLogic,
|
|
||||||
sqlSegment,
|
|
||||||
sqlComment,
|
|
||||||
alias);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildUnionSqlByWrapper(Class<?> clazz, MPJLambdaWrapper<?> wrapper) {
|
public static String buildUnionSqlByWrapper(Class<?> clazz, MPJLambdaWrapper<?> wrapper) {
|
||||||
@ -72,7 +43,7 @@ public class WrapperUtils {
|
|||||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||||
|
|
||||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||||
return String.format(" %s SELECT %s FROM %s %s %s %s %s %s %s ",
|
return String.format("( %s SELECT %s FROM %s %s %s %s %s %s %s )",
|
||||||
first,
|
first,
|
||||||
wrapper.getSqlSelect(),
|
wrapper.getSqlSelect(),
|
||||||
wrapper.getTableName(tableInfo.getTableName()),
|
wrapper.getTableName(tableInfo.getTableName()),
|
||||||
|
@ -43,15 +43,6 @@ import static java.util.stream.Collectors.joining;
|
|||||||
public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstractLambdaWrapper<T, Children>>
|
public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstractLambdaWrapper<T, Children>>
|
||||||
extends JoinAbstractWrapper<T, Children> implements QueryJoin<Children, T> {
|
extends JoinAbstractWrapper<T, Children> implements QueryJoin<Children, T> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 主表别名
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
protected String alias = ConfigProperties.tableAlias;
|
|
||||||
/**
|
|
||||||
* 副表别名
|
|
||||||
*/
|
|
||||||
protected String subTableAlias = ConfigProperties.tableAlias;
|
|
||||||
/**
|
/**
|
||||||
* 是否存在对一或对多
|
* 是否存在对一或对多
|
||||||
*/
|
*/
|
||||||
@ -229,6 +220,9 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
|||||||
|
|
||||||
public String getTableName(String tableName) {
|
public String getTableName(String tableName) {
|
||||||
if (isMain) {
|
if (isMain) {
|
||||||
|
if (this.tableName != null) {
|
||||||
|
return this.tableName;
|
||||||
|
}
|
||||||
if (dynamicTableName) {
|
if (dynamicTableName) {
|
||||||
return tableFunc.apply(tableName);
|
return tableFunc.apply(tableName);
|
||||||
}
|
}
|
||||||
@ -239,6 +233,9 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
|||||||
|
|
||||||
|
|
||||||
public String getTableNameEnc(String tableName) {
|
public String getTableNameEnc(String tableName) {
|
||||||
|
if (this.tableName != null) {
|
||||||
|
return this.tableName;
|
||||||
|
}
|
||||||
Class<T> entityClass = getEntityClass();
|
Class<T> entityClass = getEntityClass();
|
||||||
if (entityClass != null) {
|
if (entityClass != null) {
|
||||||
TableInfo tableInfo = TableHelper.get(entityClass);
|
TableInfo tableInfo = TableHelper.get(entityClass);
|
||||||
@ -433,6 +430,13 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Children from(MFunction<MPJLambdaWrapper<T>> fromWrapper) {
|
||||||
|
Assert.notNull(getEntityClass(), "main table is null please use JoinWrapper.lambda(Class) or new MPJLambdaWrapper(Class)");
|
||||||
|
MPJLambdaWrapper<T> wrapper = fromWrapper.apply(fromInstance(getEntityClass()));
|
||||||
|
this.tableName = WrapperUtils.buildUnionSqlByWrapper(getEntityClass(), wrapper);
|
||||||
|
return typedThis;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部调用, 不建议使用
|
* 内部调用, 不建议使用
|
||||||
*/
|
*/
|
||||||
@ -452,7 +456,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
|||||||
if (MPJStringUtils.isBlank(tableWrapper.getSqlSelect())) {
|
if (MPJStringUtils.isBlank(tableWrapper.getSqlSelect())) {
|
||||||
tableWrapper.selectAll();
|
tableWrapper.selectAll();
|
||||||
}
|
}
|
||||||
tabName = "(" + WrapperUtils.buildUnionSqlByWrapper(clazz, tableWrapper) + ")";
|
tabName = WrapperUtils.buildUnionSqlByWrapper(clazz, tableWrapper);
|
||||||
} else {
|
} else {
|
||||||
TableInfo info = TableHelper.getAssert(clazz);
|
TableInfo info = TableHelper.getAssert(clazz);
|
||||||
tabName = info.getTableName();
|
tabName = info.getTableName();
|
||||||
|
@ -14,9 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.sql.StringEscape;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
import com.github.yulichang.config.ConfigProperties;
|
import com.github.yulichang.config.ConfigProperties;
|
||||||
import com.github.yulichang.toolkit.LambdaUtils;
|
import com.github.yulichang.toolkit.LambdaUtils;
|
||||||
import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
|
import com.github.yulichang.toolkit.*;
|
||||||
import com.github.yulichang.toolkit.Ref;
|
|
||||||
import com.github.yulichang.toolkit.TableList;
|
|
||||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||||
import com.github.yulichang.wrapper.enums.PrefixEnum;
|
import com.github.yulichang.wrapper.enums.PrefixEnum;
|
||||||
@ -47,6 +45,15 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
implements CompareIfExists<Children>, Nested<Children, Children>, Join<Children>, Func<Children>, OnCompare<Children>,
|
implements CompareIfExists<Children>, Nested<Children, Children>, Join<Children>, Func<Children>, OnCompare<Children>,
|
||||||
CompareStrIfExists<Children, String>, FuncStr<Children, String> {
|
CompareStrIfExists<Children, String>, FuncStr<Children, String> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主表别名
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
protected String alias = ConfigProperties.tableAlias;
|
||||||
|
/**
|
||||||
|
* 副表别名
|
||||||
|
*/
|
||||||
|
protected String subTableAlias = ConfigProperties.tableAlias;
|
||||||
/**
|
/**
|
||||||
* 占位符
|
* 占位符
|
||||||
*/
|
*/
|
||||||
@ -155,6 +162,37 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
return typedThis;
|
return typedThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected <E> MPJLambdaWrapper<E> subInstance(Class<E> clazz, String st) {
|
||||||
|
MPJLambdaWrapper<E> wrapper = new MPJLambdaWrapper<E>(null, clazz, SharedString.emptyString(),
|
||||||
|
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
|
||||||
|
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
||||||
|
new TableList(), null, null, null, null, ifExists) {
|
||||||
|
};
|
||||||
|
wrapper.tableList.setAlias(st);
|
||||||
|
wrapper.tableList.setRootClass(clazz);
|
||||||
|
wrapper.tableList.setParent(this.tableList);
|
||||||
|
wrapper.alias = st;
|
||||||
|
wrapper.subTableAlias = st;
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <E> MPJLambdaWrapper<E> fromInstance(Class<E> clazz) {
|
||||||
|
MPJLambdaWrapper<E> wrapper = new MPJLambdaWrapper<E>(null, clazz, SharedString.emptyString(),
|
||||||
|
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
|
||||||
|
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
||||||
|
new TableList(), null, null, null, null, ifExists) {
|
||||||
|
};
|
||||||
|
wrapper.tableList.setAlias(this.alias);
|
||||||
|
wrapper.tableList.setRootClass(clazz);
|
||||||
|
wrapper.alias = this.alias;
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected <E> MPJLambdaWrapper<E> subInstance(Class<E> clazz) {
|
||||||
|
return subInstance(clazz, ConfigProperties.subQueryAlias);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转为子类,方便自定义继承扩展
|
* 转为子类,方便自定义继承扩展
|
||||||
*/
|
*/
|
||||||
@ -234,31 +272,61 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
return addCondition(condition, alias, column, EQ, val);
|
return addCondition(condition, alias, column, EQ, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children eq(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, EQ, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children ne(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children ne(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return addCondition(condition, alias, column, NE, val);
|
return addCondition(condition, alias, column, NE, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children ne(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, NE, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children gt(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children gt(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return addCondition(condition, alias, column, GT, val);
|
return addCondition(condition, alias, column, GT, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children gt(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, GT, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children ge(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children ge(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return addCondition(condition, alias, column, GE, val);
|
return addCondition(condition, alias, column, GE, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children ge(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, GE, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children lt(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children lt(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return addCondition(condition, alias, column, LT, val);
|
return addCondition(condition, alias, column, LT, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children lt(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, LT, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children le(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children le(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return addCondition(condition, alias, column, LE, val);
|
return addCondition(condition, alias, column, LE, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children le(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return addCondition(condition, alias, column, LE, clazz, wrapper.apply(subInstance(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children like(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
public <X> Children like(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||||
return likeValue(condition, LIKE, alias, column, val, SqlLike.DEFAULT);
|
return likeValue(condition, LIKE, alias, column, val, SqlLike.DEFAULT);
|
||||||
@ -389,26 +457,55 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
() -> String.format("(%s)", formatSqlMaybeWithParam(existsSql, null, values))));
|
() -> String.format("(%s)", formatSqlMaybeWithParam(existsSql, null, values))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> Children exists(boolean condition, Class<X> clazz, MFunction<MPJLambdaWrapper<X>> wrapper) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(EXISTS,
|
||||||
|
() -> WrapperUtils.buildUnionSqlByWrapper(clazz, wrapper.apply(subInstance(clazz)))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Children notExists(boolean condition, String existsSql, Object... values) {
|
public Children notExists(boolean condition, String existsSql, Object... values) {
|
||||||
return not(condition).exists(condition, existsSql, values);
|
return not(condition).exists(condition, existsSql, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> Children notExists(boolean condition, Class<X> clazz, MFunction<MPJLambdaWrapper<X>> wrapper) {
|
||||||
|
return not(condition).exists(condition, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children isNull(boolean condition, String alias, SFunction<X, ?> column) {
|
public <X> Children isNull(boolean condition, String alias, SFunction<X, ?> column) {
|
||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IS_NULL));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IS_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> Children isNull(boolean condition, String alias, Class<X> clazz, MFunction<MPJLambdaWrapper<X>> wrapper) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(() ->
|
||||||
|
WrapperUtils.buildUnionSqlByWrapper(clazz, wrapper.apply(fromInstance(clazz))), IS_NULL));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children isNotNull(boolean condition, String alias, SFunction<X, ?> column) {
|
public <X> Children isNotNull(boolean condition, String alias, SFunction<X, ?> column) {
|
||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IS_NOT_NULL));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IS_NOT_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> Children isNotNull(boolean condition, String alias, Class<X> clazz, MFunction<MPJLambdaWrapper<X>> wrapper) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(() ->
|
||||||
|
WrapperUtils.buildUnionSqlByWrapper(clazz, wrapper.apply(fromInstance(clazz))), IS_NOT_NULL));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children in(boolean condition, String alias, SFunction<X, ?> column, Collection<?> coll) {
|
public <X> Children in(boolean condition, String alias, SFunction<X, ?> column, Collection<?> coll) {
|
||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IN, inExpression(coll)));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IN, inExpression(coll)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children in(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IN, () ->
|
||||||
|
WrapperUtils.buildUnionSqlByWrapper(clazz, wrapper.apply(fromInstance(clazz)))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children in(boolean condition, String alias, SFunction<X, ?> column, Object... values) {
|
public <X> Children in(boolean condition, String alias, SFunction<X, ?> column, Object... values) {
|
||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IN, inExpression(values)));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), IN, inExpression(values)));
|
||||||
@ -419,6 +516,12 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), NOT_IN, inExpression(coll)));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), NOT_IN, inExpression(coll)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X, Y> Children notIn(boolean condition, String alias, SFunction<X, ?> column, Class<Y> clazz, MFunction<MPJLambdaWrapper<Y>> wrapper) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), NOT_IN, () ->
|
||||||
|
WrapperUtils.buildUnionSqlByWrapper(clazz, wrapper.apply(fromInstance(clazz)))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> Children notIn(boolean condition, String alias, SFunction<X, ?> column, Object... values) {
|
public <X> Children notIn(boolean condition, String alias, SFunction<X, ?> column, Object... values) {
|
||||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), NOT_IN, inExpression(values)));
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), NOT_IN, inExpression(values)));
|
||||||
@ -682,6 +785,11 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
|||||||
() -> formatParam(null, val)));
|
() -> formatParam(null, val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected <X, R> Children addCondition(boolean condition, String alias, SFunction<X, ?> column, SqlKeyword sqlKeyword, Class<R> clazz, MPJLambdaWrapper<R> val) {
|
||||||
|
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column, false), sqlKeyword,
|
||||||
|
() -> WrapperUtils.buildUnionSqlByWrapper(clazz, val)));
|
||||||
|
}
|
||||||
|
|
||||||
protected <X, S> Children addCondition(boolean condition, String alias, SFunction<X, ?> column,
|
protected <X, S> Children addCondition(boolean condition, String alias, SFunction<X, ?> column,
|
||||||
SqlKeyword sqlKeyword, String rightAlias, SFunction<S, ?> val) {
|
SqlKeyword sqlKeyword, String rightAlias, SFunction<S, ?> val) {
|
||||||
Class<X> c = LambdaUtils.getEntityClass(column);
|
Class<X> c = LambdaUtils.getEntityClass(column);
|
||||||
|
@ -253,16 +253,7 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
|
|||||||
* 子查询
|
* 子查询
|
||||||
*/
|
*/
|
||||||
public <E, F> MPJLambdaWrapper<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, String alias) {
|
public <E, F> MPJLambdaWrapper<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, String alias) {
|
||||||
MPJLambdaWrapper<E> wrapper = new MPJLambdaWrapper<E>(null, clazz, SharedString.emptyString(),
|
MPJLambdaWrapper<E> wrapper = subInstance(clazz, st);
|
||||||
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
|
|
||||||
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
|
||||||
new TableList(), null, null, null, null, ifExists) {
|
|
||||||
};
|
|
||||||
wrapper.tableList.setAlias(st);
|
|
||||||
wrapper.tableList.setRootClass(clazz);
|
|
||||||
wrapper.tableList.setParent(this.tableList);
|
|
||||||
wrapper.alias = st;
|
|
||||||
wrapper.subTableAlias = st;
|
|
||||||
consumer.accept(wrapper);
|
consumer.accept(wrapper);
|
||||||
this.selectColumns.add(new SelectSub(() -> WrapperUtils.buildSubSqlByWrapper(clazz, wrapper, alias), hasAlias, this.alias, alias));
|
this.selectColumns.add(new SelectSub(() -> WrapperUtils.buildSubSqlByWrapper(clazz, wrapper, alias), hasAlias, this.alias, alias));
|
||||||
return typedThis;
|
return typedThis;
|
||||||
@ -277,13 +268,7 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
|
|||||||
* @since 1.4.8
|
* @since 1.4.8
|
||||||
*/
|
*/
|
||||||
public <U> MPJLambdaWrapper<T> union(Class<U> clazz, Consumer<MPJLambdaWrapper<U>> consumer) {
|
public <U> MPJLambdaWrapper<T> union(Class<U> clazz, Consumer<MPJLambdaWrapper<U>> consumer) {
|
||||||
MPJLambdaWrapper<U> unionWrapper = new MPJLambdaWrapper<U>(null, clazz, SharedString.emptyString(),
|
MPJLambdaWrapper<U> unionWrapper = fromInstance(clazz);
|
||||||
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
|
|
||||||
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
|
||||||
new TableList(), null, null, null, null, ifExists) {
|
|
||||||
};
|
|
||||||
unionWrapper.tableList.setAlias(ConfigProperties.tableAlias);
|
|
||||||
unionWrapper.tableList.setRootClass(clazz);
|
|
||||||
consumer.accept(unionWrapper);
|
consumer.accept(unionWrapper);
|
||||||
|
|
||||||
String sb = " UNION " + WrapperUtils.buildUnionSqlByWrapper(clazz, unionWrapper);
|
String sb = " UNION " + WrapperUtils.buildUnionSqlByWrapper(clazz, unionWrapper);
|
||||||
@ -320,13 +305,7 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
|
|||||||
* @since 1.4.8
|
* @since 1.4.8
|
||||||
*/
|
*/
|
||||||
public <U> MPJLambdaWrapper<T> unionAll(Class<U> clazz, Consumer<MPJLambdaWrapper<U>> consumer) {
|
public <U> MPJLambdaWrapper<T> unionAll(Class<U> clazz, Consumer<MPJLambdaWrapper<U>> consumer) {
|
||||||
MPJLambdaWrapper<U> unionWrapper = new MPJLambdaWrapper<U>(null, clazz, SharedString.emptyString(),
|
MPJLambdaWrapper<U> unionWrapper = fromInstance(clazz);
|
||||||
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
|
|
||||||
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
|
||||||
new TableList(), null, null, null, null, ifExists) {
|
|
||||||
};
|
|
||||||
unionWrapper.tableList.setAlias(ConfigProperties.tableAlias);
|
|
||||||
unionWrapper.tableList.setRootClass(clazz);
|
|
||||||
consumer.accept(unionWrapper);
|
consumer.accept(unionWrapper);
|
||||||
|
|
||||||
String sb = " UNION ALL " + WrapperUtils.buildUnionSqlByWrapper(clazz, unionWrapper);
|
String sb = " UNION ALL " + WrapperUtils.buildUnionSqlByWrapper(clazz, unionWrapper);
|
||||||
@ -361,10 +340,15 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
|
|||||||
return String.format(i.getFunc().getSql(), str) + Constant.AS + i.getAlias();
|
return String.format(i.getFunc().getSql(), str) + Constant.AS + i.getAlias();
|
||||||
} else {
|
} else {
|
||||||
return String.format(i.getFunc().getSql(), Arrays.stream(args).map(arg -> {
|
return String.format(i.getFunc().getSql(), Arrays.stream(args).map(arg -> {
|
||||||
String pf = arg.isHasTableAlias() ? arg.getTableAlias() : tableList.getPrefixByClass(arg.getClazz());
|
if (arg.isSub()) {
|
||||||
Map<String, SelectCache> mapField = ColumnCache.getMapField(arg.getClazz());
|
Object o = arg.getSubFunc().apply(subInstance(arg.getClazz()));
|
||||||
SelectCache cache = mapField.get(arg.getProp());
|
return WrapperUtils.buildUnionSqlByWrapper(arg.getClazz(), (MPJLambdaWrapper<?>) o);
|
||||||
return pf + StringPool.DOT + cache.getColumn();
|
} else {
|
||||||
|
String pf = arg.isHasTableAlias() ? arg.getTableAlias() : tableList.getPrefixByClass(arg.getClazz());
|
||||||
|
Map<String, SelectCache> mapField = ColumnCache.getMapField(arg.getClazz());
|
||||||
|
SelectCache cache = mapField.get(arg.getProp());
|
||||||
|
return pf + StringPool.DOT + cache.getColumn();
|
||||||
|
}
|
||||||
}).toArray()) + Constant.AS + i.getAlias();
|
}).toArray()) + Constant.AS + i.getAlias();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,7 +2,6 @@ package com.github.yulichang.wrapper.interfaces;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
|
|
||||||
@ -12,7 +11,7 @@ import java.util.function.BiPredicate;
|
|||||||
* {@link com.baomidou.mybatisplus.core.conditions.interfaces.Compare}
|
* {@link com.baomidou.mybatisplus.core.conditions.interfaces.Compare}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public interface Compare<Children> extends Serializable {
|
public interface Compare<Children> extends CompareWrapper<Children> {
|
||||||
|
|
||||||
|
|
||||||
default <R, V> Children allEq(Map<SFunction<R, ?>, V> params) {
|
default <R, V> Children allEq(Map<SFunction<R, ?>, V> params) {
|
||||||
|
@ -0,0 +1,151 @@
|
|||||||
|
package com.github.yulichang.wrapper.interfaces;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将原来的泛型R改成SFunction<R, ?>
|
||||||
|
* <p>
|
||||||
|
* {@link com.baomidou.mybatisplus.core.conditions.interfaces.Compare}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface CompareWrapper<Children> extends Serializable {
|
||||||
|
|
||||||
|
default <R, T> Children eq(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return eq(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children eq(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return eq(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children eq(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return eq(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等于 =
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children eq(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
|
||||||
|
default <R, T> Children ne(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ne(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children ne(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ne(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children ne(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ne(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不等于 <>
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param alias 字段别名
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children ne(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
|
||||||
|
|
||||||
|
default <R, T> Children gt(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return gt(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children gt(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return gt(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children gt(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return gt(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大于 >
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children gt(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
|
||||||
|
default <R, T> Children ge(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ge(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children ge(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ge(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children ge(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return ge(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大于等于 >=
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children ge(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
|
||||||
|
|
||||||
|
default <R, T> Children lt(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return lt(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children lt(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return lt(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children lt(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return lt(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小于 <
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children lt(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
|
||||||
|
|
||||||
|
default <R, T> Children le(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return le(true, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children le(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return le(true, alias, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children le(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val) {
|
||||||
|
return le(condition, null, column, clazz, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小于等于 <=
|
||||||
|
*
|
||||||
|
* @param condition 执行条件
|
||||||
|
* @param column 字段
|
||||||
|
* @param val 值
|
||||||
|
* @return children
|
||||||
|
*/
|
||||||
|
<R, T> Children le(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> val);
|
||||||
|
}
|
@ -2,7 +2,6 @@ package com.github.yulichang.wrapper.interfaces;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -13,7 +12,7 @@ import java.util.function.Consumer;
|
|||||||
* copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
|
* copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked", "unused"})
|
@SuppressWarnings({"unchecked", "unused"})
|
||||||
public interface Func<Children> extends Serializable {
|
public interface Func<Children> extends FuncWrapper<Children> {
|
||||||
|
|
||||||
|
|
||||||
default <R> Children isNull(SFunction<R, ?> column) {
|
default <R> Children isNull(SFunction<R, ?> column) {
|
||||||
@ -514,7 +513,6 @@ public interface Func<Children> extends Serializable {
|
|||||||
*/
|
*/
|
||||||
Children having(boolean condition, String sqlHaving, Object... params);
|
Children having(boolean condition, String sqlHaving, Object... params);
|
||||||
|
|
||||||
|
|
||||||
default Children func(Consumer<Children> consumer) {
|
default Children func(Consumer<Children> consumer) {
|
||||||
return func(true, consumer);
|
return func(true, consumer);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.github.yulichang.wrapper.interfaces;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将原来的泛型R改成SFunction<R, ?>
|
||||||
|
* <p>
|
||||||
|
* copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unused"})
|
||||||
|
public interface FuncWrapper<Children> extends Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
default <T> Children isNull(Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNull(true, null, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T> Children isNull(String alias, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNull(true, alias, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T> Children isNull(boolean condition, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNull(condition, null, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<T> Children isNull(boolean condition, String alias, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
|
||||||
|
|
||||||
|
default <T> Children isNotNull(Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNotNull(true, null, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T> Children isNotNull(String alias, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNotNull(true, alias, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T> Children isNotNull(boolean condition, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return isNotNull(condition, null, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<T> Children isNotNull(boolean condition, String alias, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
|
||||||
|
default <R, T> Children in(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return in(true, null, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children in(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return in(true, alias, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children in(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return in(condition, null, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<R, T> Children in(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
|
||||||
|
|
||||||
|
default <R, T> Children notIn(SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return notIn(true, null, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children notIn(String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return notIn(true, alias, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <R, T> Children notIn(boolean condition, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return notIn(condition, null, column, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<R, T> Children notIn(boolean condition, String alias, SFunction<R, ?> column, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
|
||||||
|
default <T> Children exists(Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return exists(true, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<T> Children exists(boolean condition, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
|
||||||
|
default <T> Children notExists(Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper) {
|
||||||
|
return notExists(true, clazz, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
<T> Children notExists(boolean condition, Class<T> clazz, MFunction<MPJLambdaWrapper<T>> wrapper);
|
||||||
|
}
|
@ -34,7 +34,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, left, rightAlias, right);
|
return join(Constant.LEFT_JOIN, clazz, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件`
|
* @param function 条件`
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children leftJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, function);
|
return join(Constant.LEFT_JOIN, clazz, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +57,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children leftJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, left, right, ext);
|
return join(Constant.LEFT_JOIN, clazz, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +69,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param consumer 条件
|
* @param consumer 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children leftJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, consumer);
|
return join(Constant.LEFT_JOIN, clazz, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +80,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, alias, left, right);
|
return join(Constant.LEFT_JOIN, clazz, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +92,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, alias, left, rightAlias, right);
|
return join(Constant.LEFT_JOIN, clazz, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +104,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children leftJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, alias, function);
|
return join(Constant.LEFT_JOIN, clazz, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +115,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children leftJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, alias, left, right, ext);
|
return join(Constant.LEFT_JOIN, clazz, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +127,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param consumer 条件
|
* @param consumer 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children leftJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, alias, consumer);
|
return join(Constant.LEFT_JOIN, clazz, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +138,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, left, right);
|
return join(Constant.LEFT_JOIN, clazz, table, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +150,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, left, rightAlias, right);
|
return join(Constant.LEFT_JOIN, clazz, table, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +162,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件`
|
* @param function 条件`
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, function);
|
return join(Constant.LEFT_JOIN, clazz, table, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +173,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, left, right, ext);
|
return join(Constant.LEFT_JOIN, clazz, table, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +185,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param consumer 条件
|
* @param consumer 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, consumer);
|
return join(Constant.LEFT_JOIN, clazz, table, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +196,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, alias, left, right);
|
return join(Constant.LEFT_JOIN, clazz, table, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +208,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, alias, left, rightAlias, right);
|
return join(Constant.LEFT_JOIN, clazz, table, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +220,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, alias, function);
|
return join(Constant.LEFT_JOIN, clazz, table, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +231,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, alias, left, right, ext);
|
return join(Constant.LEFT_JOIN, clazz, table, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +243,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param consumer 条件
|
* @param consumer 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children leftJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.LEFT_JOIN, clazz, table, alias, consumer);
|
return join(Constant.LEFT_JOIN, clazz, table, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +250,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, left, right);
|
return join(Constant.RIGHT_JOIN, clazz, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +257,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, left, rightAlias, right);
|
return join(Constant.RIGHT_JOIN, clazz, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +264,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children rightJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, function);
|
return join(Constant.RIGHT_JOIN, clazz, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +271,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children rightJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, left, right, ext);
|
return join(Constant.RIGHT_JOIN, clazz, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +278,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children rightJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, consumer);
|
return join(Constant.RIGHT_JOIN, clazz, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +285,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, alias, left, right);
|
return join(Constant.RIGHT_JOIN, clazz, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +292,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, alias, left, rightAlias, right);
|
return join(Constant.RIGHT_JOIN, clazz, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +299,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children rightJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, alias, function);
|
return join(Constant.RIGHT_JOIN, clazz, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +306,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children rightJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, alias, left, right, ext);
|
return join(Constant.RIGHT_JOIN, clazz, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +313,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children rightJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, alias, consumer);
|
return join(Constant.RIGHT_JOIN, clazz, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +320,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, left, right);
|
return join(Constant.RIGHT_JOIN, clazz, table, left, right);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -358,7 +328,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, left, rightAlias, right);
|
return join(Constant.RIGHT_JOIN, clazz, table, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +335,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, function);
|
return join(Constant.RIGHT_JOIN, clazz, table, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +342,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, left, right, ext);
|
return join(Constant.RIGHT_JOIN, clazz, table, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +349,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, consumer);
|
return join(Constant.RIGHT_JOIN, clazz, table, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +357,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, right);
|
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +364,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, rightAlias, right);
|
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +371,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, alias, function);
|
return join(Constant.RIGHT_JOIN, clazz, table, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +378,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, right, ext);
|
return join(Constant.RIGHT_JOIN, clazz, table, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +385,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children rightJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.RIGHT_JOIN, clazz, table, alias, consumer);
|
return join(Constant.RIGHT_JOIN, clazz, table, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +392,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, left, right);
|
return join(Constant.INNER_JOIN, clazz, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +399,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, left, rightAlias, right);
|
return join(Constant.INNER_JOIN, clazz, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +406,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children innerJoin(Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, function);
|
return join(Constant.INNER_JOIN, clazz, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +413,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children innerJoin(Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, left, right, ext);
|
return join(Constant.INNER_JOIN, clazz, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +420,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children innerJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, consumer);
|
return join(Constant.INNER_JOIN, clazz, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,7 +428,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, alias, left, right);
|
return join(Constant.INNER_JOIN, clazz, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +435,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, alias, left, rightAlias, right);
|
return join(Constant.INNER_JOIN, clazz, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +442,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children innerJoin(Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, alias, function);
|
return join(Constant.INNER_JOIN, clazz, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +449,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children innerJoin(Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, alias, left, right, ext);
|
return join(Constant.INNER_JOIN, clazz, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +456,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children innerJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, alias, consumer);
|
return join(Constant.INNER_JOIN, clazz, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +463,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, left, right);
|
return join(Constant.INNER_JOIN, clazz, table, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +470,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, left, rightAlias, right);
|
return join(Constant.INNER_JOIN, clazz, table, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +477,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, function);
|
return join(Constant.INNER_JOIN, clazz, table, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +484,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, left, right, ext);
|
return join(Constant.INNER_JOIN, clazz, table, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +491,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, consumer);
|
return join(Constant.INNER_JOIN, clazz, table, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +499,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, alias, left, right);
|
return join(Constant.INNER_JOIN, clazz, table, alias, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +506,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, alias, left, rightAlias, right);
|
return join(Constant.INNER_JOIN, clazz, table, alias, left, rightAlias, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +513,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, alias, function);
|
return join(Constant.INNER_JOIN, clazz, table, alias, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +520,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, alias, left, right, ext);
|
return join(Constant.INNER_JOIN, clazz, table, alias, left, right, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,7 +527,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* ignore 参考 left join
|
* ignore 参考 left join
|
||||||
*/
|
*/
|
||||||
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children innerJoin(Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(Constant.INNER_JOIN, clazz, table, alias, consumer);
|
return join(Constant.INNER_JOIN, clazz, table, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +612,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, null, (on, e) -> on.eq(left, right));
|
return join(keyWord, clazz, null, null, (on, e) -> on.eq(left, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +626,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, null, (on, e) -> on.eq(left, rightAlias, right));
|
return join(keyWord, clazz, null, null, (on, e) -> on.eq(left, rightAlias, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,7 +638,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children join(String keyWord, Class<T> clazz, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, null, (on, e) -> function.apply(on));
|
return join(keyWord, clazz, null, null, (on, e) -> function.apply(on));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +649,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, null, (on, e) -> {
|
return join(keyWord, clazz, null, null, (on, e) -> {
|
||||||
on.eq(left, right);
|
on.eq(left, right);
|
||||||
ext.apply(e);
|
ext.apply(e);
|
||||||
@ -722,7 +659,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* 内部使用, 不建议直接调用
|
* 内部使用, 不建议直接调用
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children join(String keyWord, Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, null, consumer);
|
return join(keyWord, clazz, null, null, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +674,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, alias, (on, e) -> on.eq(left, right));
|
return join(keyWord, clazz, null, alias, (on, e) -> on.eq(left, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +689,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, alias, (on, e) -> on.eq(left, rightAlias, right));
|
return join(keyWord, clazz, null, alias, (on, e) -> on.eq(left, rightAlias, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +701,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children join(String keyWord, Class<T> clazz, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, alias, (on, e) -> function.apply(on));
|
return join(keyWord, clazz, null, alias, (on, e) -> function.apply(on));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +712,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, alias, (on, e) -> {
|
return join(keyWord, clazz, null, alias, (on, e) -> {
|
||||||
on.eq(left, right);
|
on.eq(left, right);
|
||||||
ext.apply(e);
|
ext.apply(e);
|
||||||
@ -790,7 +722,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* 内部使用, 不建议直接调用
|
* 内部使用, 不建议直接调用
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children join(String keyWord, Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(keyWord, clazz, null, alias, consumer);
|
return join(keyWord, clazz, null, alias, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,7 +737,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, null, (on, e) -> on.eq(left, right));
|
return join(keyWord, clazz, table, null, (on, e) -> on.eq(left, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +751,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, null, (on, e) -> on.eq(left, rightAlias, right));
|
return join(keyWord, clazz, table, null, (on, e) -> on.eq(left, rightAlias, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +763,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, null, (on, e) -> function.apply(on));
|
return join(keyWord, clazz, table, null, (on, e) -> function.apply(on));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +774,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, null, (on, e) -> {
|
return join(keyWord, clazz, table, null, (on, e) -> {
|
||||||
on.eq(left, right);
|
on.eq(left, right);
|
||||||
ext.apply(e);
|
ext.apply(e);
|
||||||
@ -857,7 +784,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* 内部使用, 不建议直接调用
|
* 内部使用, 不建议直接调用
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, null, consumer);
|
return join(keyWord, clazz, table, null, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,7 +799,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, alias, (on, e) -> on.eq(left, right));
|
return join(keyWord, clazz, table, alias, (on, e) -> on.eq(left, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -889,7 +814,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 扩展 用于关联表的 select 和 where
|
* @param right 扩展 用于关联表的 select 和 where
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, String rightAlias, SFunction<X, ?> right) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, alias, (on, e) -> on.eq(left, rightAlias, right));
|
return join(keyWord, clazz, table, alias, (on, e) -> on.eq(left, rightAlias, right));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +826,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param function 条件
|
* @param function 条件
|
||||||
*/
|
*/
|
||||||
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
default <T> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, MFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, alias, (on, e) -> function.apply(on));
|
return join(keyWord, clazz, table, alias, (on, e) -> function.apply(on));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,7 +837,6 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
|||||||
* @param right 条件
|
* @param right 条件
|
||||||
*/
|
*/
|
||||||
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
default <T, X> Children join(String keyWord, Class<T> clazz, MConsumer<MPJLambdaWrapper<T>> table, String alias, SFunction<T, ?> left, SFunction<X, ?> right, MFunction<Children> ext) {
|
||||||
|
|
||||||
return join(keyWord, clazz, table, alias, (on, e) -> {
|
return join(keyWord, clazz, table, alias, (on, e) -> {
|
||||||
on.eq(left, right);
|
on.eq(left, right);
|
||||||
ext.apply(e);
|
ext.apply(e);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.github.yulichang.wrapper.segments;
|
package com.github.yulichang.wrapper.segments;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.github.yulichang.wrapper.interfaces.MFunction;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -20,7 +22,12 @@ public class Fun<T, R> implements SFunction<T, R> {
|
|||||||
private final String alias;
|
private final String alias;
|
||||||
private final SFunction<T, R> func;
|
private final SFunction<T, R> func;
|
||||||
|
|
||||||
|
private final boolean isSub;
|
||||||
|
private final Class<T> clazz;
|
||||||
|
private final MFunction<MPJLambdaWrapper<T>> sub;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public R apply(T t) {
|
public R apply(T t) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
@ -31,6 +38,15 @@ public class Fun<T, R> implements SFunction<T, R> {
|
|||||||
* 仅对selectFunc有效
|
* 仅对selectFunc有效
|
||||||
*/
|
*/
|
||||||
public static <T, R> Fun<T, R> f(String alias, SFunction<T, R> func) {
|
public static <T, R> Fun<T, R> f(String alias, SFunction<T, R> func) {
|
||||||
return new Fun<>(alias, func);
|
return new Fun<>(alias, func, false, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 别名func
|
||||||
|
* <p>
|
||||||
|
* 仅对selectFunc有效
|
||||||
|
*/
|
||||||
|
public static <T, R> Fun<T, R> f(Class<T> clazz, MFunction<MPJLambdaWrapper<T>> func) {
|
||||||
|
return new Fun<>(null, null, true, clazz, func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ package com.github.yulichang.wrapper.segments;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
import com.github.yulichang.toolkit.LambdaUtils;
|
import com.github.yulichang.toolkit.LambdaUtils;
|
||||||
import com.github.yulichang.wrapper.enums.BaseFuncEnum;
|
import com.github.yulichang.wrapper.enums.BaseFuncEnum;
|
||||||
|
import com.github.yulichang.wrapper.interfaces.MFunction;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.ibatis.type.JdbcType;
|
import org.apache.ibatis.type.JdbcType;
|
||||||
@ -72,12 +73,18 @@ public class SelectFunc implements Select {
|
|||||||
this.index = index;
|
this.index = index;
|
||||||
this.column = null;
|
this.column = null;
|
||||||
this.args = Arrays.stream(args).map(i -> {
|
this.args = Arrays.stream(args).map(i -> {
|
||||||
boolean ins = i instanceof Fun;
|
if (i instanceof Fun) {
|
||||||
if (ins) {
|
|
||||||
Fun<?, ?> f = (Fun<?, ?>) i;
|
Fun<?, ?> f = (Fun<?, ?>) i;
|
||||||
return new Arg(LambdaUtils.getEntityClass(f.getFunc()), LambdaUtils.getName(f.getFunc()), true, f.getAlias(), null);
|
if (f.isSub()) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return new Arg(f.getClazz(), null, false, null, null, true, (MFunction<Object>) ((Object) f.getSub()));
|
||||||
|
} else {
|
||||||
|
return new Arg(LambdaUtils.getEntityClass(f.getFunc()), LambdaUtils.getName(f.getFunc()),
|
||||||
|
true, f.getAlias(), null, false, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return new Arg(LambdaUtils.getEntityClass(i), LambdaUtils.getName(i), false, null, null);
|
return new Arg(LambdaUtils.getEntityClass(i), LambdaUtils.getName(i), false,
|
||||||
|
null, null, false, null);
|
||||||
}
|
}
|
||||||
}).toArray(Arg[]::new);
|
}).toArray(Arg[]::new);
|
||||||
this.cache = null;
|
this.cache = null;
|
||||||
@ -170,5 +177,7 @@ public class SelectFunc implements Select {
|
|||||||
private final boolean hasTableAlias;
|
private final boolean hasTableAlias;
|
||||||
private final String tableAlias;
|
private final String tableAlias;
|
||||||
private final Object property;
|
private final Object property;
|
||||||
|
private final boolean isSub;
|
||||||
|
private final MFunction<Object> subFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
<module>test-join</module>
|
<module>test-join</module>
|
||||||
<module>test-collection</module>
|
<module>test-collection</module>
|
||||||
<module>test-mapping</module>
|
<module>test-mapping</module>
|
||||||
|
|
||||||
<!-- 以下两个模块需要jdk17+, 使用jdk8会出现编译错误, 如果有安装jdk17+可以打开这两个模块 -->
|
|
||||||
<module>test-kotlin</module>
|
<module>test-kotlin</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@ -49,7 +47,7 @@
|
|||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>1.5.1</revision>
|
<revision>1.5.2</revision>
|
||||||
<mybatis.plus.version>3.5.8</mybatis.plus.version>
|
<mybatis.plus.version>3.5.8</mybatis.plus.version>
|
||||||
|
|
||||||
<jdkVersion>17</jdkVersion>
|
<jdkVersion>17</jdkVersion>
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.34</version>
|
|
||||||
</path>
|
</path>
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
import com.github.yulichang.annotation.DynamicTableName;
|
|
||||||
import com.github.yulichang.annotation.Table;
|
import com.github.yulichang.annotation.Table;
|
||||||
import com.github.yulichang.test.join.dto.UserJson;
|
import com.github.yulichang.test.join.dto.UserJson;
|
||||||
import com.github.yulichang.test.join.enums.Sex;
|
import com.github.yulichang.test.join.enums.Sex;
|
||||||
@ -23,7 +22,6 @@ import java.util.List;
|
|||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@DynamicTableName
|
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
@TableName(value = "`user`", autoResultMap = true)
|
@TableName(value = "`user`", autoResultMap = true)
|
||||||
public class UserDO extends ID<Integer> implements Serializable {
|
public class UserDO extends ID<Integer> implements Serializable {
|
||||||
|
@ -0,0 +1,247 @@
|
|||||||
|
package com.github.yulichang.test.join.unit;
|
||||||
|
|
||||||
|
import com.github.yulichang.test.join.entity.AddressDO;
|
||||||
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
|
import com.github.yulichang.test.util.EnabledIfConfig;
|
||||||
|
import com.github.yulichang.test.util.Reset;
|
||||||
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit.jupiter.EnabledIf;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
|
||||||
|
public class ConditionSubTest {
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
Reset.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select 子查询
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
void conditionSub() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id >= ? AND t.id <= ? AND
|
||||||
|
t.id = (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id = t.id AND st.id >= ? AND st.id <= ?))
|
||||||
|
AND t.id >= ? AND t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, -2)
|
||||||
|
.le(UserDO::getId, 102)
|
||||||
|
.eq(UserDO::getId, UserDO.class, w -> w
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100))
|
||||||
|
.ge(UserDO::getId, -1)
|
||||||
|
.le(UserDO::getId, 101);
|
||||||
|
|
||||||
|
wrapper.list();
|
||||||
|
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id = (SELECT sst.id FROM `user` sst WHERE sst.del = false AND (sst.id = t.id AND sst.id >= ? AND sst.id <= ?)))
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO.class, w -> w
|
||||||
|
.setAlias("sst")
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100));
|
||||||
|
wrapper1.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void conditionSubIn() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id >= ? AND t.id <= ? AND
|
||||||
|
t.id IN (SELECT t.id FROM `user` t WHERE t.del = false AND (t.id >= ? AND t.id <= ?)) AND t.id >= ? AND
|
||||||
|
t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, -2)
|
||||||
|
.le(UserDO::getId, 102)
|
||||||
|
.in(UserDO::getId, UserDO.class, u -> u
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100))
|
||||||
|
.ge(UserDO::getId, -1)
|
||||||
|
.le(UserDO::getId, 101);
|
||||||
|
wrapper1.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void conditionSubExists() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id >= ? AND t.id <= ? AND
|
||||||
|
EXISTS (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id >= ? AND st.id <= ?)) AND t.id >= ? AND
|
||||||
|
t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, -2)
|
||||||
|
.le(UserDO::getId, 102)
|
||||||
|
.exists(UserDO.class, u -> u
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100))
|
||||||
|
.ge(UserDO::getId, -1)
|
||||||
|
.le(UserDO::getId, 101);
|
||||||
|
wrapper1.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void conditionSubHaving() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id >= ? AND t.id <= ? AND
|
||||||
|
NOT EXISTS (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id >= ? AND st.id <= ?)) AND t.id >= ? AND
|
||||||
|
t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, -2)
|
||||||
|
.le(UserDO::getId, 102)
|
||||||
|
.notExists(UserDO.class, h -> h
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100))
|
||||||
|
.ge(UserDO::getId, -1)
|
||||||
|
.le(UserDO::getId, 101);
|
||||||
|
wrapper1.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void conditionSubEQ() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by
|
||||||
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id >= ? AND t.id <= ? AND
|
||||||
|
t.id = (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id = t1.id AND st.id >= ? AND st.id <= ?)) AND
|
||||||
|
t.id >= ? AND t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, -2)
|
||||||
|
.le(UserDO::getId, 102)
|
||||||
|
.eq(UserDO::getId, UserDO.class, u -> u
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.eq(UserDO::getId, AddressDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100))
|
||||||
|
.ge(UserDO::getId, -1)
|
||||||
|
.le(UserDO::getId, 101);
|
||||||
|
wrapper1.list();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.github.yulichang.test.join.unit;
|
||||||
|
|
||||||
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
|
import com.github.yulichang.test.util.EnabledIfConfig;
|
||||||
|
import com.github.yulichang.test.util.Reset;
|
||||||
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit.jupiter.EnabledIf;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
|
||||||
|
public class FromTest {
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
Reset.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select 子查询
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
void from() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT
|
||||||
|
t.id, t.pid, t.`name`, t.`json`, t.sex, t.head_img, t.create_time,
|
||||||
|
t.address_id, t.address_id2, t.del, t.create_by, t.update_by
|
||||||
|
FROM (SELECT
|
||||||
|
t.id, t.pid, t.`name`, t.`json`, t.sex, t.head_img, t.create_time,
|
||||||
|
t.address_id, t.address_id2, t.del, t.create_by, t.update_by
|
||||||
|
FROM `user` t WHERE t.del = false AND (t.id >= ?)) t
|
||||||
|
WHERE t.del = false
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.from(from -> from
|
||||||
|
.selectAll()
|
||||||
|
.ge(UserDO::getId, 0));
|
||||||
|
wrapper.list();
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,8 @@ import com.github.yulichang.test.join.entity.UserDO;
|
|||||||
import com.github.yulichang.test.util.Reset;
|
import com.github.yulichang.test.util.Reset;
|
||||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
import com.github.yulichang.toolkit.JoinWrappers;
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.github.yulichang.wrapper.segments.Fun;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -47,4 +49,43 @@ public class SelectFuncTest {
|
|||||||
list.forEach(System.out::println);
|
list.forEach(System.out::println);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void applyFunc1() {
|
||||||
|
ThreadLocalUtils.set("""
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.pid,
|
||||||
|
t.`name`,
|
||||||
|
t.`json`,
|
||||||
|
t.sex,
|
||||||
|
t.head_img,
|
||||||
|
t.create_time,
|
||||||
|
t.address_id,
|
||||||
|
t.address_id2,
|
||||||
|
t.del,
|
||||||
|
t.create_by,
|
||||||
|
t.update_by,
|
||||||
|
(SELECT st.id FROM `user` st WHERE st.del = false AND (st.id = t.id)) AS address
|
||||||
|
FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id = (SELECT sst.id FROM `user` sst WHERE sst.del = false AND (sst.id = t.id AND sst.id >= ? AND sst.id <= ?)))
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.selectFunc("%s", arg -> arg.accept(
|
||||||
|
Fun.f(UserDO.class, u -> u
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO::getId))),
|
||||||
|
UserDTO::getAddress)
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO.class, w -> w
|
||||||
|
.setAlias("sst")
|
||||||
|
.select(UserDO::getId)
|
||||||
|
.eq(UserDO::getId, UserDO::getId)
|
||||||
|
.ge(UserDO::getId, 0)
|
||||||
|
.le(UserDO::getId, 100));
|
||||||
|
wrapper1.list(UserDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,14 +66,26 @@ public class SelectSubTest {
|
|||||||
.le(UserDO::getId, 100);
|
.le(UserDO::getId, 100);
|
||||||
wrapper.list();
|
wrapper.list();
|
||||||
|
|
||||||
// ThreadLocalUtils.set("SELECT (SELECT st.id FROM area st WHERE st.del = false AND (st.id = t1.id) LIMIT 1) AS id FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false AND (t.id <= ?)");
|
ThreadLocalUtils.set("""
|
||||||
// MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
SELECT
|
||||||
// .selectSub(AreaDO.class, w -> w.select(AreaDO::getId)
|
(SELECT
|
||||||
// .eq(AreaDO::getId, AddressDO::getId)
|
st.id
|
||||||
// .last("limit 1"), UserDO::getId)
|
FROM area st
|
||||||
// .leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
WHERE st.del = false
|
||||||
// .le(UserDO::getId, 100);
|
AND (st.id = t1.id) LIMIT 1) AS id
|
||||||
// wrapper1.list();
|
FROM `user` t
|
||||||
|
LEFT JOIN address t1 ON (t1.user_id = t.id)
|
||||||
|
WHERE t.del = false
|
||||||
|
AND t1.del = false
|
||||||
|
AND (t.id <= ?)
|
||||||
|
""");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectSub(AreaDO.class, w -> w.select(AreaDO::getId)
|
||||||
|
.eq(AreaDO::getId, AddressDO::getId)
|
||||||
|
.last("limit 1"), UserDO::getId)
|
||||||
|
.leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
|
||||||
|
.le(UserDO::getId, 100);
|
||||||
|
wrapper1.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,7 +23,7 @@ public class UnionTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void unionAll1() {
|
void unionAll() {
|
||||||
ThreadLocalUtils.set("""
|
ThreadLocalUtils.set("""
|
||||||
SELECT
|
SELECT
|
||||||
t.id
|
t.id
|
||||||
@ -31,12 +31,12 @@ public class UnionTest {
|
|||||||
WHERE t.del = false
|
WHERE t.del = false
|
||||||
AND (t.id = ?)
|
AND (t.id = ?)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
(SELECT
|
||||||
t.id
|
t.id
|
||||||
FROM address t
|
FROM address t
|
||||||
WHERE (t.id = ?)
|
WHERE (t.id = ?))
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
(SELECT
|
||||||
(SELECT
|
(SELECT
|
||||||
st.id
|
st.id
|
||||||
FROM area st
|
FROM area st
|
||||||
@ -44,7 +44,7 @@ public class UnionTest {
|
|||||||
AND (st.id = ? AND (st.id = ?))) AS id
|
AND (st.id = ? AND (st.id = ?))) AS id
|
||||||
FROM area t
|
FROM area t
|
||||||
WHERE t.del = false
|
WHERE t.del = false
|
||||||
AND (t.id = ? AND (t.id = ?))
|
AND (t.id = ? AND (t.id = ?)))
|
||||||
""");
|
""");
|
||||||
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
||||||
.select(UserDO::getId)
|
.select(UserDO::getId)
|
||||||
|
@ -4,14 +4,12 @@ import com.baomidou.mybatisplus.annotation.TableField
|
|||||||
import com.baomidou.mybatisplus.annotation.TableLogic
|
import com.baomidou.mybatisplus.annotation.TableLogic
|
||||||
import com.baomidou.mybatisplus.annotation.TableName
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
|
||||||
import com.github.yulichang.annotation.DynamicTableName
|
|
||||||
import com.github.yulichang.test.kt.enums.Sex
|
import com.github.yulichang.test.kt.enums.Sex
|
||||||
import lombok.experimental.FieldNameConstants
|
import lombok.experimental.FieldNameConstants
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@DynamicTableName
|
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
@TableName(value = "`user`", autoResultMap = true)
|
@TableName(value = "`user`", autoResultMap = true)
|
||||||
open class UserDO : ID<Int?>(), Serializable {
|
open class UserDO : ID<Int?>(), Serializable {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user