com.easy.query.api4j.sql.SQLColumnSetter Maven / Gradle / Ivy
package com.easy.query.api4j.sql;
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.ColumnSetter;
import com.easy.query.core.util.EasyLambdaUtil;
/**
* create time 2023/6/1 08:40
* 强类型setter
*
* @author xuejiaming
*/
public interface SQLColumnSetter {
default TableAvailable getTable() {
return getColumnSetter().getTable();
}
ColumnSetter getColumnSetter();
/**
* set column=val
*/
default SQLColumnSetter set(Property column, Object val) {
return set(true, column, val);
}
/**
* set column=val
*
* @param condition 执行条件
* @param column 字段
* @param val 值
* @return children
*/
default SQLColumnSetter set(boolean condition, Property column, Object val) {
getColumnSetter().set(condition, EasyLambdaUtil.getPropertyName(column), val);
return this;
}
default SQLColumnSetter setWithColumn(Property column1, Property column2) {
return setWithColumn(true, column1, column2);
}
default SQLColumnSetter setWithColumn(boolean condition, Property column1, Property column2) {
getColumnSetter().setWithColumn(condition, EasyLambdaUtil.getPropertyName(column1), EasyLambdaUtil.getPropertyName(column2));
return this;
}
default SQLColumnSetter setIncrement(Property column) {
return setIncrement(true, column);
}
default SQLColumnSetter setIncrement(boolean condition, Property column) {
return setIncrementNumber(condition, column, 1);
}
default SQLColumnSetter setIncrement(Property column, int val) {
return setIncrementNumber(true, column,val);
}
default SQLColumnSetter setIncrement(boolean condition, Property column, int val){
return setIncrementNumber(condition,column,val);
}
default SQLColumnSetter setIncrement(Property column, long val) {
return setIncrementNumber(true, column,val);
}
default SQLColumnSetter setIncrement(boolean condition, Property column, long val) {
return setIncrementNumber(condition, column, val);
}
default SQLColumnSetter setIncrement(Property column, Number val) {
return setIncrementNumber(true, column, val);
}
default SQLColumnSetter setIncrementNumber(boolean condition, Property column, Number val) {
getColumnSetter().setIncrementNumber(condition, EasyLambdaUtil.getPropertyName(column), val);
return this;
}
default SQLColumnSetter setDecrement(Property column) {
return setDecrement(true, column);
}
default SQLColumnSetter setDecrement(boolean condition, Property column) {
return setDecrementNumber(condition, column, 1);
}
default SQLColumnSetter setDecrement(Property column, int val) {
return setDecrementNumber(true, column,val);
}
default SQLColumnSetter setDecrement(boolean condition, Property column, int val){
return setDecrementNumber(condition,column,val);
}
default SQLColumnSetter setDecrement(Property column, long val) {
return setDecrementNumber(true, column,val);
}
default SQLColumnSetter setDecrement(boolean condition, Property column, long val) {
return setDecrementNumber(condition, column, val);
}
default SQLColumnSetter setDecrement(Property column, Number val) {
return setDecrementNumber(true, column, val);
}
default SQLColumnSetter setDecrementNumber(boolean condition, Property column, Number val) {
getColumnSetter().setDecrementNumber(condition, EasyLambdaUtil.getPropertyName(column), val);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy