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

com.easy.query.api4j.sql.impl.SQLWherePredicateImpl Maven / Gradle / Ivy

package com.easy.query.api4j.sql.impl;

import com.easy.query.api4j.sql.SQLWherePredicate;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.parser.core.base.WherePredicate;

/**
 * @author xuejiaming
 * @Description: 默认的数据库条件比较
 * @Date: 2023/2/7 06:58
 */
public class SQLWherePredicateImpl implements SQLWherePredicate {
    private final WherePredicate wherePredicate;

    public SQLWherePredicateImpl(WherePredicate wherePredicate) {
        this.wherePredicate = wherePredicate;
    }

    @Override
    public WherePredicate getWherePredicate() {
        return wherePredicate;
    }

    @Override
    public SQLWherePredicate and(boolean condition, SQLExpression1> sqlWherePredicateSQLExpression) {
        getWherePredicate().and(condition, predicate -> {
            SQLWherePredicate sqlPredicate = new SQLWherePredicateImpl(predicate);
            sqlWherePredicateSQLExpression.apply(sqlPredicate);
        });
        return this;
    }

    @Override
    public SQLWherePredicate or(boolean condition, SQLExpression1> sqlWherePredicateSQLExpression) {
        getWherePredicate().or(condition, predicate -> {
            SQLWherePredicate sqlPredicate = new SQLWherePredicateImpl(predicate);
            sqlWherePredicateSQLExpression.apply(sqlPredicate);
        });
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy