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

com.easy.query.api4j.sql.SQLColumnAsSelector Maven / Gradle / Ivy

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

import com.easy.query.api4j.select.Queryable;
import com.easy.query.api4j.sql.impl.SQLWherePredicateImpl;
import com.easy.query.core.context.QueryRuntimeContext;
import com.easy.query.core.expression.func.ColumnPropertyFunction;
import com.easy.query.core.expression.lambda.Property;
import com.easy.query.core.expression.parser.core.available.TableAvailable;
import com.easy.query.core.expression.parser.core.base.ColumnAsSelector;
import com.easy.query.core.util.EasyLambdaUtil;

import java.util.function.Function;

/**
 * @author xuejiaming
 * @Description: 文件说明
 * @Date: 2023/2/6 22:58
 */
public interface SQLColumnAsSelector {
    ColumnAsSelector getColumnAsSelector();

    default QueryRuntimeContext getRuntimeContext() {
        return getColumnAsSelector().getRuntimeContext();
    }

    default TableAvailable getTable() {
        return getColumnAsSelector().getTable();
    }

    default SQLColumnAsSelector column(Property column) {
        getColumnAsSelector().column(EasyLambdaUtil.getPropertyName(column));
        return this;
    }
    default SQLColumnAsSelector columnConstAs(String columnConst, String alias) {
        getColumnAsSelector().columnConstAs(columnConst,alias);
        return this;
    }

    default SQLColumnAsSelector columnIgnore(Property column) {
        getColumnAsSelector().columnIgnore(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    /**
     * 映射到TR的所有列上,按ColumnName进行映射,如果TR上没有对应的列名那么将不会映射查询列
     *
     * @return
     */
    default SQLColumnAsSelector columnAll() {
        getColumnAsSelector().columnAll();
        return this;
    }

    default SQLColumnAsSelector columnAs(Property column, Property alias) {
        return columnAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnAs(Property column, String alias) {
        getColumnAsSelector().columnAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default  SQLColumnAsSelector columnSubQueryAs(Function, Queryable> subQueryableFunc, String alias) {
        getColumnAsSelector().columnSubQueryAs(wherePredicate -> {
            return subQueryableFunc.apply(new SQLWherePredicateImpl<>(wherePredicate));
        }, alias);
        return this;
    }

    default  SQLColumnAsSelector columnSubQueryAs(Function, Queryable> subQueryableFunc, Property alias) {
        return columnSubQueryAs(subQueryableFunc, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnCount(Property column) {
        getColumnAsSelector().columnCount(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnCountAs(Property column, String alias) {
        getColumnAsSelector().columnCountAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnCountAs(Property column, Property alias) {
        return columnCountAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnCountDistinct(Property column) {
        getColumnAsSelector().columnCountDistinct(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnCountDistinctAs(Property column, String alias) {
        getColumnAsSelector().columnCountDistinctAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnCountDistinctAs(Property column, Property alias) {
        return columnCountDistinctAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnSum(Property column) {
        getColumnAsSelector().columnSum(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnSumAs(Property column, Property alias) {
        return columnSumAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnSumAs(Property column, String alias) {
        getColumnAsSelector().columnSumAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnSumDistinct(Property column) {
        getColumnAsSelector().columnSumDistinct(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnSumDistinctAs(Property column, Property alias) {
        return columnSumDistinctAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnSumDistinctAs(Property column, String alias) {
        getColumnAsSelector().columnSumDistinctAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnMax(Property column) {
        getColumnAsSelector().columnMax(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnMaxAs(Property column, Property alias) {
        return columnMaxAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnMaxAs(Property column, String alias) {
        getColumnAsSelector().columnMaxAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnMin(Property column) {
        getColumnAsSelector().columnMin(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnMinAs(Property column, Property alias) {
        return columnMinAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnMinAs(Property column, String alias) {
        getColumnAsSelector().columnMinAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnAvg(Property column) {
        getColumnAsSelector().columnAvg(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnAvgAs(Property column, Property alias) {
        return columnAvgAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnAvgAs(Property column, String alias) {
        getColumnAsSelector().columnAvgAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnAvgDistinct(Property column) {
        getColumnAsSelector().columnAvgDistinct(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnAvgDistinctAs(Property column, Property alias) {
        return columnAvgDistinctAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnAvgDistinctAs(Property column, String alias) {
        getColumnAsSelector().columnAvgDistinctAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnLen(Property column) {
        getColumnAsSelector().columnLen(EasyLambdaUtil.getPropertyName(column));
        return this;
    }

    default SQLColumnAsSelector columnLenAs(Property column, Property alias) {
        return columnLenAs(column, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnLenAs(Property column, String alias) {
        getColumnAsSelector().columnLenAs(EasyLambdaUtil.getPropertyName(column), alias);
        return this;
    }

    default SQLColumnAsSelector columnFuncAs(ColumnPropertyFunction columnPropertyFunction, Property alias) {
        return columnFuncAs(columnPropertyFunction, EasyLambdaUtil.getPropertyName(alias));
    }

    default SQLColumnAsSelector columnFuncAs(ColumnPropertyFunction columnPropertyFunction, String alias) {
        getColumnAsSelector().columnFuncAs(columnPropertyFunction, alias);
        return this;
    }

    default  SQLColumnAsSelector then(SQLColumnAsSelector sub) {
        getColumnAsSelector().then(sub.getColumnAsSelector());
        return sub;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy