com.easy.query.core.proxy.AbstractProxyEntity Maven / Gradle / Ivy
package com.easy.query.core.proxy;
import com.easy.query.core.basic.api.select.Query;
import com.easy.query.core.expression.RelationEntityTableAvailable;
import com.easy.query.core.expression.RelationTableKey;
import com.easy.query.core.expression.lambda.SQLActionExpression;
import com.easy.query.core.expression.lambda.SQLExpression1;
import com.easy.query.core.expression.lambda.SQLFuncExpression;
import com.easy.query.core.expression.lambda.SQLFuncExpression1;
import com.easy.query.core.expression.parser.core.SQLTableOwner;
import com.easy.query.core.expression.parser.core.available.TableAvailable;
import com.easy.query.core.expression.sql.builder.EntityTableExpressionBuilder;
import com.easy.query.core.proxy.core.Expression;
import com.easy.query.core.proxy.impl.SQLColumnIncludeColumn2Impl;
import com.easy.query.core.proxy.impl.SQLConstantExpressionImpl;
import com.easy.query.core.proxy.impl.SQLDraftAsSelectImpl;
import com.easy.query.core.proxy.impl.SQLPredicateImpl;
import com.easy.query.core.proxy.impl.SQLSelectAllImpl;
import com.easy.query.core.proxy.impl.SQLSelectAsEntryImpl;
import com.easy.query.core.proxy.impl.SQLSelectIgnoreImpl;
import com.easy.query.core.proxy.impl.SQLSelectKeysImpl;
import com.easy.query.core.proxy.sql.scec.SQLNativeProxyExpressionContext;
import com.easy.query.core.util.EasyObjectUtil;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* create time 2023/6/25 12:39
* 文件说明
*
* @author xuejiaming
*/
public abstract class AbstractProxyEntity, TEntity> extends AbstractBaseProxyEntity {
protected , TProperty> TPropertyProxy getValueObject(TPropertyProxy propertyProxy) {
propertyProxy._setProxy(castChain());
return propertyProxy;
}
protected String getValueProperty(String property) {
return property;
}
public void or(SQLActionExpression sqlActionExpression) {
or(true, sqlActionExpression);
}
public void or(boolean condition, SQLActionExpression sqlActionExpression) {
if (condition) {
getEntitySQLContext()._whereOr(sqlActionExpression);
}
}
public void and(SQLActionExpression sqlActionExpression) {
and(true, sqlActionExpression);
}
public void and(boolean condition, SQLActionExpression sqlActionExpression) {
if (condition) {
getEntitySQLContext()._whereAnd(sqlActionExpression);
}
}
/**
* 支持where having order
* 请使用{@link #expression()}或者{@link Expression#sql(String)}
*
* @param sqlSegment
*/
@Deprecated
public void executeSQL(String sqlSegment) {
executeSQL(sqlSegment, c -> {
});
}
/**
* 支持where having order
* 请使用{@link #expression()}或者{@link Expression#sql(String, SQLExpression1)}
*
* @param sqlSegment
* @param contextConsume
*/
@Deprecated
public void executeSQL(String sqlSegment, SQLExpression1 contextConsume) {
executeSQL(true, sqlSegment, contextConsume);
}
/**
* 支持where having order
* 请使用{@link #expression()}或者{@link Expression#sql(boolean, String, SQLExpression1)}
*
* @param condition
* @param sqlSegment
* @param contextConsume
*/
@Deprecated
public void executeSQL(boolean condition, String sqlSegment, SQLExpression1 contextConsume) {
if (condition) {
getEntitySQLContext()._executeNativeSql(sqlSegment, contextConsume);
}
}
protected N __cast(T original) {
return EasyObjectUtil.typeCastNullable(original);
}
// /**
// * 返回group或者selectDraft自定义sql片段
// * 请使用{@link #expression()}或者{@link Expression#sqlType(String)}
// *
// * {@code
// *
// * .select((t, t1, t2) -> new QueryVOProxy() {{
// * t.sql("now()");
// * //指定返回类型给draft类型进行明确
// * //t.sql("now()").setPropertyType(String.class);
// * }}).toList();
// * }
// *
// * @param sqlSegment
// * @return
// */
// @Deprecated
// public PropTypeColumn© 2015 - 2024 Weber Informatics LLC | Privacy Policy