FilterNode增加readonly属性
This commit is contained in:
@@ -25,6 +25,8 @@ import org.redkale.util.*;
|
||||
*/
|
||||
public class FilterNode { //FilterNode 不能实现Serializable接口, 否则DataSource很多重载接口会出现冲突
|
||||
|
||||
protected boolean readOnly;
|
||||
|
||||
protected String column;
|
||||
|
||||
protected FilterExpress express;
|
||||
@@ -80,6 +82,16 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
public FilterNode asReadOnly() {
|
||||
this.readOnly = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FilterNode readOnly(boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long findLongValue(final String col, long defValue) {
|
||||
Serializable val = findValue(col);
|
||||
return val == null ? defValue : ((Number) val).longValue();
|
||||
@@ -138,6 +150,7 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
||||
}
|
||||
|
||||
protected FilterNode any(FilterNode node, boolean signor) {
|
||||
if (this.readOnly) throw new RuntimeException("FilterNode(" + this + ") is ReadOnly");
|
||||
Objects.requireNonNull(node);
|
||||
if (this.column == null) {
|
||||
this.column = node.column;
|
||||
@@ -1861,6 +1874,14 @@ public class FilterNode { //FilterNode 不能实现Serializable接口, 否则
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
public final boolean isOr() {
|
||||
return or;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user