diff --git a/dorive-api/pom.xml b/dorive-api/pom.xml
index 9fe8d72bfe5f5b6d6714f1538f5abac38aab35a0..71548f1aea57ca11a3337352b68824e8f0f64bad 100644
--- a/dorive-api/pom.xml
+++ b/dorive-api/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-api
diff --git a/dorive-coating/pom.xml b/dorive-coating/pom.xml
index 4ced627da53a4084d9e68a017f4b91400ba68e97..7ca5ef2f92ac8966fcc25400a2f95f93e910a5dc 100644
--- a/dorive-coating/pom.xml
+++ b/dorive-coating/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-coating
diff --git a/dorive-core/pom.xml b/dorive-core/pom.xml
index f3692fe080470b9eade1d5113f1d588b24491724..354dfcc7f751bf02dd11215dc98dc88cac521b77 100644
--- a/dorive-core/pom.xml
+++ b/dorive-core/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-core
diff --git a/dorive-core/src/main/java/com/gitee/dorive/core/api/constant/Select.java b/dorive-core/src/main/java/com/gitee/dorive/core/api/constant/Select.java
new file mode 100644
index 0000000000000000000000000000000000000000..2daf51e7742a64151006aa024ac00ac415ef37dc
--- /dev/null
+++ b/dorive-core/src/main/java/com/gitee/dorive/core/api/constant/Select.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gitee.dorive.core.api.constant;
+
+import com.gitee.dorive.core.api.context.Selector;
+import com.gitee.dorive.core.impl.selector.NameSelector;
+import com.gitee.dorive.core.impl.selector.RootSelector;
+
+public interface Select {
+ Selector ALL = new NameSelector("*");
+ Selector ROOT = new RootSelector();
+}
diff --git a/dorive-core/src/main/java/com/gitee/dorive/core/impl/executor/ChainExecutor.java b/dorive-core/src/main/java/com/gitee/dorive/core/impl/executor/ChainExecutor.java
index c6d77aba4c35640653de1685db5f3764fa916233..9315f01c9bfdc0ab033f389ea3841b92e6c186e2 100644
--- a/dorive-core/src/main/java/com/gitee/dorive/core/impl/executor/ChainExecutor.java
+++ b/dorive-core/src/main/java/com/gitee/dorive/core/impl/executor/ChainExecutor.java
@@ -88,13 +88,13 @@ public class ChainExecutor extends AbstractExecutor implements EntityHandler {
public int execute(Context context, Operation operation) {
int expectedType = operation.getType();
+ boolean isIncludeRoot = (expectedType & OperationType.INCLUDE_ROOT) == OperationType.INCLUDE_ROOT;
+ boolean isIgnoreRoot = (expectedType & OperationType.IGNORE_ROOT) == OperationType.IGNORE_ROOT;
int realExpectedType = expectedType & OperationType.INSERT_OR_UPDATE_OR_DELETE;
- int expectedIgnoreRoot = expectedType | OperationType.IGNORE_ROOT;
- int expectedIncludeRoot = expectedType | OperationType.INCLUDE_ROOT;
- boolean isInsertContext = (expectedType & OperationType.INSERT) == OperationType.INSERT;
- boolean isIgnoreRoot = (expectedType & OperationType.IGNORE_ROOT) == OperationType.IGNORE_ROOT;
- boolean isIncludeRoot = (expectedType & OperationType.INCLUDE_ROOT) == OperationType.INCLUDE_ROOT;
+ boolean isInsertContext = (realExpectedType & OperationType.INSERT) == OperationType.INSERT;
+ int expectedIncludeRoot = realExpectedType | OperationType.INCLUDE_ROOT;
+ int expectedIgnoreRoot = realExpectedType | OperationType.IGNORE_ROOT;
Object rootEntity = operation.getEntity();
Assert.notNull(rootEntity, "The rootEntity cannot be null!");
@@ -106,19 +106,19 @@ public class ChainExecutor extends AbstractExecutor implements EntityHandler {
Selector selector = context.getSelector();
int totalCount = 0;
for (CommonRepository repository : delegateRepository.getOrderedRepositories()) {
- boolean root = repository.isRoot();
- if (isIgnoreRoot && root) {
+ boolean isRoot = repository.isRoot();
+ if (isIgnoreRoot && isRoot) {
continue;
}
- boolean isMatch = selector.matches(context, repository) || (isIncludeRoot && root);
+ boolean isMatch = selector.matches(context, repository) || (isIncludeRoot && isRoot);
boolean isAggregated = repository.isAggregated();
if (!isMatch && !isAggregated) {
continue;
}
PropChain anchorPoint = repository.getAnchorPoint();
- Object targetEntity = root ? rootEntity : anchorPoint.getValue(rootEntity);
+ Object targetEntity = isRoot ? rootEntity : anchorPoint.getValue(rootEntity);
if (targetEntity != null) {
Collection> collection;
if (targetEntity instanceof Collection) {
@@ -142,7 +142,7 @@ public class ChainExecutor extends AbstractExecutor implements EntityHandler {
totalCount += repository.execute(context, newOperation);
} else if (operable) {
- if (root && realExpectedType == operationType) {
+ if (isRoot && realExpectedType == operationType) {
totalCount += repository.execute(context, operation);
} else {
totalCount += doExecute(operationType, repository, context, entity);
diff --git a/dorive-core/src/main/java/com/gitee/dorive/core/impl/selector/RootSelector.java b/dorive-core/src/main/java/com/gitee/dorive/core/impl/selector/RootSelector.java
new file mode 100644
index 0000000000000000000000000000000000000000..7252c2d3d8c2ef50ba187081255ac771cd3672dd
--- /dev/null
+++ b/dorive-core/src/main/java/com/gitee/dorive/core/impl/selector/RootSelector.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gitee.dorive.core.impl.selector;
+
+import com.gitee.dorive.core.api.context.Context;
+import com.gitee.dorive.core.repository.CommonRepository;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class RootSelector extends AbstractSelector {
+
+ @Override
+ public boolean matches(Context context, CommonRepository repository) {
+ return repository.isRoot();
+ }
+
+ @Override
+ public List selectColumns(Context context, CommonRepository repository) {
+ return null;
+ }
+
+}
diff --git a/dorive-event/pom.xml b/dorive-event/pom.xml
index d21af2c5fb95918298d04ada266eeef673022181..9c0151204bc6080a7b6abed53c2e7a622cca777a 100644
--- a/dorive-event/pom.xml
+++ b/dorive-event/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-event
diff --git a/dorive-injection/pom.xml b/dorive-injection/pom.xml
index 0652a57e5249d88257bf42c0db4c56404eabc870..24f2c76d2f7983a45a982954e098fbe61600850c 100644
--- a/dorive-injection/pom.xml
+++ b/dorive-injection/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-injection
diff --git a/dorive-proxy/pom.xml b/dorive-proxy/pom.xml
index 1dd33e7bbb28ef95a00bddc55eb1423cb13aa2ff..ab21722e73e52d4a1b94963f2f8c89195025515d 100644
--- a/dorive-proxy/pom.xml
+++ b/dorive-proxy/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-proxy
diff --git a/dorive-ref/pom.xml b/dorive-ref/pom.xml
index 59abf3a007ab955de2d6557decf0d3e4517ae8af..6c61fdfdb3dc7db260c0107c358b53ce69e21ccc 100644
--- a/dorive-ref/pom.xml
+++ b/dorive-ref/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-ref
diff --git a/dorive-spring-boot-starter/pom.xml b/dorive-spring-boot-starter/pom.xml
index 57015d375d7d9ee53c4de7df0d628a5b798257ab..2ef45530589bc463d50ef02d47c52fa1230061ba 100644
--- a/dorive-spring-boot-starter/pom.xml
+++ b/dorive-spring-boot-starter/pom.xml
@@ -6,7 +6,7 @@
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
dorive-spring-boot-starter
diff --git a/pom.xml b/pom.xml
index 39f7d1bc15122cb34dbc2155a722753c1b3a648a..cb448d0a2d774e299c0fb0ef2f8425bb1736104f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.gitee.digital-engine
dorive
- 3.3.2
+ 3.3.3
pom