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

com.easy.query.api4j.select.extension.queryable2.SQLHavingable2 Maven / Gradle / Ivy

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

import com.easy.query.api4j.select.Queryable2;
import com.easy.query.api4j.sql.SQLWhereAggregatePredicate;
import com.easy.query.api4j.sql.impl.SQLWhereAggregatePredicateImpl;
import com.easy.query.core.common.tuple.Tuple2;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.lambda.SQLExpression2;

/**
 * create time 2023/8/16 08:49
 * 文件说明
 *
 * @author xuejiaming
 */
public interface SQLHavingable2 extends ClientQueryable2Available, Queryable2Available {

    default Queryable2 having(SQLExpression2, SQLWhereAggregatePredicate> predicateExpression) {
        getClientQueryable2().having((predicate1, predicate2) -> {
            predicateExpression.apply(new SQLWhereAggregatePredicateImpl<>(predicate1), new SQLWhereAggregatePredicateImpl<>(predicate2));
        });
        return getQueryable2();
    }

    default Queryable2 having(boolean condition, SQLExpression2, SQLWhereAggregatePredicate> predicateExpression) {
        getClientQueryable2().having(condition, (predicate1, predicate2) -> {
            predicateExpression.apply(new SQLWhereAggregatePredicateImpl<>(predicate1), new SQLWhereAggregatePredicateImpl<>(predicate2));
        });
        return getQueryable2();
    }
    default Queryable2 havingMerge(SQLExpression1, SQLWhereAggregatePredicate>> predicateExpression) {
        return havingMerge(true, predicateExpression);
    }

    default Queryable2 havingMerge(boolean condition, SQLExpression1, SQLWhereAggregatePredicate>> predicateExpression){
        return having(condition,(t1, t2)->{
            predicateExpression.apply(new Tuple2<>(t1, t2));
        });
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy