mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 17:48:25 +08:00
optimize QueryCondition.getPrevEffectiveCondition
This commit is contained in:
parent
945cee12e3
commit
6e08986d39
@ -83,15 +83,15 @@ public class Brackets extends QueryCondition {
|
||||
if (checkEffective()) {
|
||||
String childSql = childCondition.toSql(queryTables, dialect);
|
||||
if (StringUtil.isNotBlank(childSql)) {
|
||||
QueryCondition prevCondition = getPrevEffectiveCondition();
|
||||
if (prevCondition != null) {
|
||||
childSql = prevCondition.connector + "(" + childSql + ")";
|
||||
QueryCondition prevEffectiveCondition = getPrevEffectiveCondition();
|
||||
if (prevEffectiveCondition != null) {
|
||||
childSql = prevEffectiveCondition.connector + "(" + childSql + ")";
|
||||
} else if (StringUtil.isNotBlank(sqlNext)) {
|
||||
childSql = "(" + childSql + ")";
|
||||
}
|
||||
sql.append(childSql);
|
||||
} else {
|
||||
//all child conditions is not effective
|
||||
//all child conditions are not effective
|
||||
//fixed gitee #I6W89G
|
||||
this.effective = false;
|
||||
}
|
||||
|
||||
@ -217,13 +217,10 @@ public class QueryCondition implements CloneSupport<QueryCondition> {
|
||||
|
||||
|
||||
protected QueryCondition getPrevEffectiveCondition() {
|
||||
if (prev != null && prev.checkEffective()) {
|
||||
return prev;
|
||||
} else if (prev != null) {
|
||||
return prev.getPrevEffectiveCondition();
|
||||
} else {
|
||||
if (prev == null) {
|
||||
return null;
|
||||
}
|
||||
return prev.checkEffective() ? prev : prev.getPrevEffectiveCondition();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user