com.easy.query.api4j.select.extension.queryable3.SQLJoinable3 Maven / Gradle / Ivy
package com.easy.query.api4j.select.extension.queryable3;
import com.easy.query.api4j.select.Queryable;
import com.easy.query.api4j.select.Queryable4;
import com.easy.query.api4j.select.impl.EasyQueryable4;
import com.easy.query.api4j.sql.SQLWherePredicate;
import com.easy.query.api4j.sql.impl.SQLWherePredicateImpl;
import com.easy.query.core.basic.api.select.ClientQueryable4;
import com.easy.query.core.common.tuple.Tuple4;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.lambda.SQLExpression4;
/**
* create time 2023/8/16 09:11
* 文件说明
*
* @author xuejiaming
*/
public interface SQLJoinable3 extends ClientQueryable3Available {
/**
* {@code
* leftJoin(Entity2.class, (t1, t2,t3, t4) -> t.eq(t2, Entity::getId, Entity2::getId))
* }
* t代表from的表,t1代表第一次join的表,t2代表第二次join的表
*
* @param joinClass 和哪张表进行join
* @param on 条件
* @param
* @return 返回可查询的表达式支持3表参数
*/
default Queryable4 leftJoin(Class joinClass, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().leftJoin(joinClass, (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 leftJoin(Queryable joinQueryable, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().leftJoin(joinQueryable.getClientQueryable(), (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 rightJoin(Class joinClass, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().rightJoin(joinClass, (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 rightJoin(Queryable joinQueryable, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().rightJoin(joinQueryable.getClientQueryable(), (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 innerJoin(Class joinClass, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().innerJoin(joinClass, (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 innerJoin(Queryable joinQueryable, SQLExpression4, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate> on){
ClientQueryable4 entityQueryable4 = getClientQueryable3().innerJoin(joinQueryable.getClientQueryable(), (where1, where2, where3, where4) -> {
on.apply(new SQLWherePredicateImpl<>(where1), new SQLWherePredicateImpl<>(where2), new SQLWherePredicateImpl<>(where3), new SQLWherePredicateImpl<>(where4));
});
return new EasyQueryable4<>(entityQueryable4);
}
default Queryable4 leftJoinMerge(Class joinClass, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return leftJoin(joinClass, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
default Queryable4 leftJoinMerge(Queryable joinQueryable, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return leftJoin(joinQueryable, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
default Queryable4 rightJoinMerge(Class joinClass, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return rightJoin(joinClass, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
default Queryable4 rightJoinMerge(Queryable joinQueryable, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return rightJoin(joinQueryable, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
default Queryable4 innerJoinMerge(Class joinClass, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return innerJoin(joinClass, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
default Queryable4 innerJoinMerge(Queryable joinQueryable, SQLExpression1, SQLWherePredicate, SQLWherePredicate, SQLWherePredicate>> on) {
return innerJoin(joinQueryable, (t1, t2,t3, t4) -> {
on.apply(new Tuple4<>(t1, t2,t3, t4));
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy