All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.easy.query.api4j.select.abstraction.AbstractQueryable2 Maven / Gradle / Ivy

There is a newer version: 2.3.3
Show newest version
package com.easy.query.api4j.select.abstraction;

import com.easy.query.api4j.select.Queryable;
import com.easy.query.api4j.select.Queryable2;
import com.easy.query.api4j.select.Queryable3;
import com.easy.query.api4j.select.impl.EasyQueryable;
import com.easy.query.api4j.select.impl.EasyQueryable3;
import com.easy.query.api4j.sql.SQLColumnAsSelector;
import com.easy.query.api4j.sql.SQLGroupBySelector;
import com.easy.query.api4j.sql.SQLOrderBySelector;
import com.easy.query.api4j.sql.SQLWhereAggregatePredicate;
import com.easy.query.api4j.sql.SQLWherePredicate;
import com.easy.query.api4j.sql.impl.SQLColumnAsSelectorImpl;
import com.easy.query.api4j.sql.impl.SQLWherePredicateImpl;
import com.easy.query.core.basic.api.select.ClientQueryable;
import com.easy.query.core.basic.api.select.ClientQueryable2;
import com.easy.query.core.basic.api.select.ClientQueryable3;
import com.easy.query.core.enums.sharding.ConnectionModeEnum;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.lambda.SQLExpression2;
import com.easy.query.core.expression.lambda.SQLExpression3;

import java.util.function.Function;

/**
 * @author xuejiaming
 * @FileName: AbstractQueryable2.java
 * @Description: 文件说明
 * @Date: 2023/2/6 23:43
 */
public abstract class AbstractQueryable2 extends AbstractQueryable implements Queryable2 {


    protected final ClientQueryable2 entityQueryable2;

    public AbstractQueryable2(ClientQueryable2 entityQueryable2) {
        super(entityQueryable2);
        this.entityQueryable2 = entityQueryable2;
    }

    @Override
    public ClientQueryable2 getClientQueryable2() {
        return entityQueryable2;
    }

    @Override
    public  Queryable3 leftJoin(Class joinClass, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.leftJoin(joinClass, (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public  Queryable3 leftJoin(Queryable joinQueryable, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.leftJoin(joinQueryable.getEntityQueryable(), (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public  Queryable3 rightJoin(Class joinClass, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.rightJoin(joinClass, (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public  Queryable3 rightJoin(Queryable joinQueryable, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.rightJoin(joinQueryable.getEntityQueryable(), (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public  Queryable3 innerJoin(Class joinClass, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.innerJoin(joinClass, (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public  Queryable3 innerJoin(Queryable joinQueryable, SQLExpression3, SQLWherePredicate, SQLWherePredicate> on) {
        ClientQueryable3 entityQueryable3 = entityQueryable2.innerJoin(joinQueryable.getEntityQueryable(), (wherePredicate1, wherePredicate2, wherePredicate3) -> {
            on.apply(new SQLWherePredicateImpl<>(wherePredicate1), new SQLWherePredicateImpl<>(wherePredicate2), new SQLWherePredicateImpl<>(wherePredicate3));
        });
        return new EasyQueryable3<>(entityQueryable3);
    }

    @Override
    public Queryable2 whereById(boolean condition, Object id) {
        super.whereById(condition, id);
        return this;
    }

    @Override
    public Queryable2 whereObject(boolean condition, Object object) {
        super.whereObject(condition, object);
        return this;
    }

    @Override
    public Queryable2 where(boolean condition, SQLExpression1> whereExpression) {
        super.where(condition, whereExpression);
        return this;
    }


    @Override
    public  Queryable select(Class resultClass, SQLExpression2, SQLColumnAsSelector> selectExpression) {
        ClientQueryable select = entityQueryable2.select(resultClass, (selector1, selector2) -> {
            selectExpression.apply(new SQLColumnAsSelectorImpl<>(selector1), new SQLColumnAsSelectorImpl<>(selector2));
        });
        return new EasyQueryable<>(select);
    }

    @Override
    public Queryable2 orderByAsc(boolean condition, SQLExpression1> selectExpression) {
        super.orderByAsc(condition, selectExpression);
        return this;
    }

    @Override
    public Queryable2 orderByDesc(boolean condition, SQLExpression1> selectExpression) {
        super.orderByDesc(condition, selectExpression);
        return this;
    }

    @Override
    public Queryable2 groupBy(boolean condition, SQLExpression1> selectExpression) {
        super.groupBy(condition, selectExpression);
        return this;
    }

    @Override
    public Queryable2 having(boolean condition, SQLExpression1> predicateExpression) {
        super.having(condition, predicateExpression);
        return this;
    }

    @Override
    public Queryable2 limit(boolean condition, long offset, long rows) {
        super.limit(condition, offset, rows);
        return this;
    }

    @Override
    public Queryable2 distinct(boolean condition) {
        super.distinct(condition);
        return this;
    }

    @Override
    public Queryable2 disableLogicDelete() {
        super.disableLogicDelete();
        return this;
    }

    @Override
    public Queryable2 enableLogicDelete() {
        super.enableLogicDelete();
        return this;
    }

    @Override
    public Queryable2 useLogicDelete(boolean enable) {
        super.useLogicDelete(enable);
        return this;
    }

    @Override
    public Queryable2 noInterceptor() {
        super.noInterceptor();
        return this;
    }

    @Override
    public Queryable2 useInterceptor(String name) {
        super.useInterceptor(name);
        return this;
    }

    @Override
    public Queryable2 noInterceptor(String name) {
        super.noInterceptor(name);
        return this;
    }

    @Override
    public Queryable2 useInterceptor() {
        super.useInterceptor();
        return this;
    }

    @Override
    public Queryable2 asTracking() {
        super.asTracking();
        return this;
    }

    @Override
    public Queryable2 asNoTracking() {
        super.asNoTracking();
        return this;
    }

    @Override
    public Queryable2 queryLargeColumn(boolean queryLarge) {
        super.queryLargeColumn(queryLarge);
        return this;
    }

    @Override
    public Queryable2 useShardingConfigure(int maxShardingQueryLimit, ConnectionModeEnum connectionMode) {
        super.useShardingConfigure(maxShardingQueryLimit, connectionMode);
        return this;
    }

    @Override
    public Queryable2 useMaxShardingQueryLimit(int maxShardingQueryLimit) {
        super.useMaxShardingQueryLimit(maxShardingQueryLimit);
        return this;
    }

    @Override
    public Queryable2 useConnectionMode(ConnectionModeEnum connectionMode) {
        super.useConnectionMode(connectionMode);
        return this;
    }

    @Override
    public Queryable2 asTable(Function tableNameAs) {
        super.asTable(tableNameAs);
        return this;
    }

    @Override
    public Queryable2 asSchema(Function schemaAs) {
        super.asSchema(schemaAs);
        return this;
    }

    @Override
    public Queryable2 asAlias(String alias) {
        super.asAlias(alias);
        return this;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy