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

com.easy.query.api4j.update.EntityUpdatable Maven / Gradle / Ivy

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

import com.easy.query.api4j.sql.SQLColumnSetSelector;
import com.easy.query.api4j.sql.impl.SQLColumnSetSelectorImpl;
import com.easy.query.core.basic.api.internal.SQLExecuteStrategy;
import com.easy.query.core.basic.api.update.ClientEntityUpdatable;
import com.easy.query.core.basic.api.update.Updatable;
import com.easy.query.core.expression.lambda.SQLExpression1;

/**
 * @author xuejiaming
 * @FileName: EntityUpdate.java
 * @Description: 文件说明
 * @Date: 2023/2/24 23:22
 */
public interface EntityUpdatable extends Updatable>, SQLExecuteStrategy> {
    ClientEntityUpdatable getClientUpdate();

    default EntityUpdatable setColumns(SQLExpression1> columnSelectorExpression) {
        getClientUpdate().setColumns(selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default EntityUpdatable setColumns(boolean condition, SQLExpression1> columnSelectorExpression) {
        getClientUpdate().setColumns(condition, selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default EntityUpdatable setIgnoreColumns(SQLExpression1> columnSelectorExpression) {
        getClientUpdate().setIgnoreColumns(true, selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default EntityUpdatable setIgnoreColumns(boolean condition, SQLExpression1> columnSelectorExpression) {
        getClientUpdate().setIgnoreColumns(condition, selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default EntityUpdatable whereColumns(SQLExpression1> columnSelectorExpression) {
        getClientUpdate().whereColumns(selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default EntityUpdatable whereColumns(boolean condition, SQLExpression1> columnSelectorExpression) {
        getClientUpdate().whereColumns(condition, selector -> {
            columnSelectorExpression.apply(new SQLColumnSetSelectorImpl<>(selector));
        });
        return this;
    }

    default String toSQL(Object entity) {
        return getClientUpdate().toSQL(entity);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy