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

com.easy.query.api4j.select.extension.queryable2.SQLOrderable2 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.SQLOrderBySelector;
import com.easy.query.api4j.sql.impl.SQLOrderByColumnSelectorImpl;
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:50
 * 文件说明
 *
 * @author xuejiaming
 */
public interface SQLOrderable2 extends ClientQueryable2Available, Queryable2Available {

    default Queryable2 orderByAsc(SQLExpression2, SQLOrderBySelector> selectExpression) {
        getClientQueryable2().orderByAsc((selector1, selector2) -> {
            selectExpression.apply(new SQLOrderByColumnSelectorImpl<>(selector1), new SQLOrderByColumnSelectorImpl<>(selector2));
        });
        return getQueryable2();
    }

    default Queryable2 orderByAsc(boolean condition, SQLExpression2, SQLOrderBySelector> selectExpression) {
        getClientQueryable2().orderByAsc(condition, (selector1, selector2) -> {
            selectExpression.apply(new SQLOrderByColumnSelectorImpl<>(selector1), new SQLOrderByColumnSelectorImpl<>(selector2));
        });
        return getQueryable2();
    }

    default Queryable2 orderByAscMerge(SQLExpression1, SQLOrderBySelector>> selectExpression) {
        return orderByAscMerge(true, selectExpression);
    }

   default Queryable2 orderByAscMerge(boolean condition, SQLExpression1, SQLOrderBySelector>> selectExpression){
        return orderByAsc(condition,(t1, t2)->{
            selectExpression.apply(new Tuple2<>(t1, t2));
        });
   }


    default Queryable2 orderByDesc(SQLExpression2, SQLOrderBySelector> selectExpression) {
        return orderByDesc(true, selectExpression);
    }

   default Queryable2 orderByDesc(boolean condition, SQLExpression2, SQLOrderBySelector> selectExpression){
       getClientQueryable2().orderByDesc(condition, (selector1, selector2) -> {
           selectExpression.apply(new SQLOrderByColumnSelectorImpl<>(selector1), new SQLOrderByColumnSelectorImpl<>(selector2));
       });
        return getQueryable2();
   }

    default Queryable2 orderByDescMerge(SQLExpression1, SQLOrderBySelector>> selectExpression) {
        return orderByDescMerge(true, selectExpression);
    }

   default Queryable2 orderByDescMerge(boolean condition, SQLExpression1, SQLOrderBySelector>> selectExpression){
        return orderByDesc(condition,(t1, t2)->{
            selectExpression.apply(new Tuple2<>(t1, t2));
        });
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy