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

com.easy.query.api4j.select.extension.queryable2.SQLAggregatable2 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.sql.SQLColumnResultSelector;
import com.easy.query.api4j.sql.impl.SQLColumnResultSelectorImpl;
import com.easy.query.core.common.tuple.Tuple2;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.lambda.SQLExpression2;

import java.math.BigDecimal;

/**
 * create time 2023/8/15 21:54
 * 文件说明
 *
 * @author xuejiaming
 */
public interface SQLAggregatable2 extends ClientQueryable2Available {

    /**
     * 防止溢出
     *
     * @param columnSelectorExpression
     * @param 
     * @return
     */
    default  BigDecimal sumBigDecimalOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().sumBigDecimalOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }


    default  BigDecimal sumBigDecimalOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, BigDecimal def) {
        return getClientQueryable2().sumBigDecimalOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  TMember sumOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().sumOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  TMember sumOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, TMember def) {
        return getClientQueryable2().sumOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  TMember maxOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().maxOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  TMember maxOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, TMember def) {
        return getClientQueryable2().maxOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  TMember minOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().minOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  TMember minOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, TMember def) {
        return getClientQueryable2().minOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  Double avgOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().avgOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  BigDecimal avgBigDecimalOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().avgBigDecimalOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  Float avgFloatOrNull(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression) {
        return getClientQueryable2().avgFloatOrNull((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        });
    }

    default  Double avgOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, Double def) {
        return getClientQueryable2().avgOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  BigDecimal avgBigDecimalOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, BigDecimal def) {
        return getClientQueryable2().avgBigDecimalOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  Float avgFloatOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, Float def) {
        return getClientQueryable2().avgFloatOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def);
    }

    default  TResult avgOrDefault(SQLExpression2, SQLColumnResultSelector> columnSelectorExpression, TResult def, Class resultClass) {
        return getClientQueryable2().avgOrDefault((selector1, selector2) -> {
            columnSelectorExpression.apply(new SQLColumnResultSelectorImpl<>(selector1), new SQLColumnResultSelectorImpl<>(selector2));
        }, def, resultClass);
    }




    /**
     * 防止溢出
     *
     * @param columnSelectorExpression
     * @param 
     * @return
     */
    default  BigDecimal sumBigDecimalOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().sumBigDecimalOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }


    default  BigDecimal sumBigDecimalOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, BigDecimal def) {
        return getClientQueryable2().sumBigDecimalOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  TMember sumOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().sumOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  TMember sumOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, TMember def) {
        return getClientQueryable2().sumOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  TMember maxOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().maxOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  TMember maxOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, TMember def) {
        return getClientQueryable2().maxOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  TMember minOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().minOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  TMember minOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, TMember def) {
        return getClientQueryable2().minOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  Double avgOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().avgOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  BigDecimal avgBigDecimalOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().avgBigDecimalOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  Float avgFloatOrNullMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression) {
        return getClientQueryable2().avgFloatOrNullMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        });
    }

    default  Double avgOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, Double def) {
        return getClientQueryable2().avgOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  BigDecimal avgBigDecimalOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, BigDecimal def) {
        return getClientQueryable2().avgBigDecimalOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  Float avgFloatOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, Float def) {
        return getClientQueryable2().avgFloatOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def);
    }

    default  TResult avgOrDefaultMerge(SQLExpression1, SQLColumnResultSelector>> columnSelectorExpression, TResult def, Class resultClass) {
        return getClientQueryable2().avgOrDefaultMerge((tuple2) -> {
            columnSelectorExpression.apply(new Tuple2<>(new SQLColumnResultSelectorImpl<>(tuple2.t()),new SQLColumnResultSelectorImpl<>(tuple2.t1())));
        }, def, resultClass);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy