Просмотр исходного кода

Merge branch 'feature/searchDesigner' into 'wrdp'

[平台]设计搜索条件下层到设计元素(流程、表单或脚本等)

See merge request o2oa/o2oa!2637
胡起 5 лет назад
Родитель
Сommit
b4d6e4323c

+ 84 - 10
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WiDesigner.java

@@ -2,11 +2,9 @@ package com.x.base.core.project.jaxrs;
 
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.gson.GsonPropertyObject;
+import org.apache.commons.lang3.StringUtils;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class WiDesigner extends GsonPropertyObject {
 
@@ -20,8 +18,8 @@ public class WiDesigner extends GsonPropertyObject {
     private Boolean matchRegExp;
     @FieldDescribe("设计类型:script|form|page|widget|process")
     private List<String> designerTypes = new ArrayList<>();
-    @FieldDescribe("应用ID列表.")
-    private List<String> appIdList = new ArrayList<>();
+    @FieldDescribe("模块的应用列表.")
+    private List<ModuleApp> moduleAppList = new ArrayList<>();
 
     public String getKeyword() {
         return keyword;
@@ -63,11 +61,87 @@ public class WiDesigner extends GsonPropertyObject {
         this.designerTypes = designerTypes;
     }
 
-    public List<String> getAppIdList() {
-        return appIdList == null ? new ArrayList<>() : appIdList;
+    public List<ModuleApp> getModuleAppList() {
+        return moduleAppList == null ? new ArrayList<>() : moduleAppList;
     }
 
-    public void setAppIdList(List<String> appIdList) {
-        this.appIdList = appIdList;
+    public void setModuleAppList(List<ModuleApp> moduleAppList) {
+        this.moduleAppList = moduleAppList;
+    }
+
+    public List<String> getAppIdList(){
+        Set<String> set = new HashSet<>();
+        for (ModuleApp app : this.getModuleAppList()){
+            set.add(app.getAppId());
+        }
+        return new ArrayList<>(set);
+    }
+
+    public Map<String, List<String>> getAppDesigner(){
+        Map<String, List<String>> map = new HashMap<>();
+        for (ModuleApp app : this.getModuleAppList()){
+            for(Designer designer : app.getDesignerList()){
+                String designerType = designer.getDesignerType();
+                if(StringUtils.isNotBlank(designerType)){
+                    if (map.containsKey(designerType)){
+                        map.get(designerType).addAll(designer.getDesignerIdList());
+                    } else{
+                        if(!designer.getDesignerIdList().isEmpty()) {
+                            map.put(designerType, designer.getDesignerIdList());
+                        }
+                    }
+                }
+            }
+        }
+        return map;
+    }
+
+    public class ModuleApp extends GsonPropertyObject {
+        @FieldDescribe("应用ID.")
+        private String appId;
+
+        @FieldDescribe("设计列表.")
+        private List<Designer> designerList;
+
+        public String getAppId() {
+            return appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+
+        public List<Designer> getDesignerList() {
+            return designerList == null ? new ArrayList<>() : designerList;
+        }
+
+        public void setDesignerList(List<Designer> designerList) {
+            this.designerList = designerList;
+        }
+    }
+
+    public class Designer extends GsonPropertyObject {
+
+        @FieldDescribe("设计类型.")
+        private String designerType;
+
+        @FieldDescribe("设计ID列表.")
+        private List<String> designerIdList;
+
+        public String getDesignerType() {
+            return designerType;
+        }
+
+        public void setDesignerType(String designerType) {
+            this.designerType = designerType;
+        }
+
+        public List<String> getDesignerIdList() {
+            return designerIdList == null ? new ArrayList<>() : designerIdList;
+        }
+
+        public void setDesignerIdList(List<String> designerIdList) {
+            this.designerIdList = designerIdList;
+        }
     }
 }

+ 20 - 10
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/designer/ActionSearch.java

@@ -46,11 +46,15 @@ class ActionSearch extends BaseAction {
 
 		List<Wo> resWos = new ArrayList<>();
 		List<CompletableFuture<List<Wo>>> list = new ArrayList<>();
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.form.toString())){
-			list.add(searchForm(wi, wi.getAppIdList()));
+		Map<String, List<String>> designerMap = wi.getAppDesigner();
+		List<String> appList = wi.getAppIdList();
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.form.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.form.toString()))){
+			list.add(searchForm(wi, appList, designerMap.get(DesignerType.form.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString())){
-			list.add(searchScript(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.script.toString()))){
+			list.add(searchScript(wi, appList, designerMap.get(DesignerType.script.toString())));
 		}
 		for (CompletableFuture<List<Wo>> cf : list){
 			if(resWos.size()<50) {
@@ -65,15 +69,18 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoScript> woScripts;
-				if (ListTools.isEmpty(appIdList)) {
-					woScripts = emc.fetchAll(Script.class, WoScript.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.appId_FIELDNAME, appIdList);
+				} else {
+					woScripts = emc.fetchAll(Script.class, WoScript.copier);
+
 				}
 
 				for (WoScript woScript : woScripts) {
@@ -103,12 +110,15 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchForm(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchForm(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				Business business = new Business(emc);
-				List<String> formIds = business.getFormFactory().listByAppIds(appIdList);
+				List<String> formIds = designerIdList;
+				if(ListTools.isEmpty(formIds)) {
+					formIds = business.getFormFactory().listByAppIds(appIdList);
+				}
 				for (List<String> partFormIds : ListTools.batch(formIds, 100)) {
 					List<WoForm> woForms = emc.fetchIn(Form.class, WoForm.copier, Form.id_FIELDNAME, partFormIds);
 					for (WoForm woForm : woForms) {

+ 27 - 14
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -46,14 +46,19 @@ class ActionSearch extends BaseAction {
 
 		List<Wo> resWos = new ArrayList<>();
 		List<CompletableFuture<List<Wo>>> list = new ArrayList<>();
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.form.toString())){
-			list.add(searchPage(wi, wi.getAppIdList()));
+		Map<String, List<String>> designerMap = wi.getAppDesigner();
+		List<String> appList = wi.getAppIdList();
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.page.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.page.toString()))){
+			list.add(searchPage(wi, appList, designerMap.get(DesignerType.page.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString())){
-			list.add(searchScript(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.script.toString()))){
+			list.add(searchScript(wi, appList, designerMap.get(DesignerType.script.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.widget.toString())){
-			list.add(searchWidget(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.widget.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.widget.toString()))){
+			list.add(searchWidget(wi, appList, designerMap.get(DesignerType.widget.toString())));
 		}
 		for (CompletableFuture<List<Wo>> cf : list){
 			if(resWos.size()<50) {
@@ -68,15 +73,17 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoScript> woScripts;
-				if (ListTools.isEmpty(appIdList)) {
-					woScripts = emc.fetchAll(Script.class, WoScript.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.portal_FIELDNAME, appIdList);
+				} else {
+					woScripts = emc.fetchAll(Script.class, WoScript.copier);
 				}
 
 				for (WoScript woScript : woScripts) {
@@ -106,12 +113,15 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchPage(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchPage(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				Business business = new Business(emc);
-				List<String> ids = business.page().listWithPortals(appIdList);
+				List<String> ids = designerIdList;
+				if(ListTools.isEmpty(ids)) {
+					ids = business.page().listWithPortals(appIdList);
+				}
 				for (List<String> partIds : ListTools.batch(ids, 100)) {
 					List<WoPage> wos = emc.fetchIn(Page.class, WoPage.copier, Page.id_FIELDNAME, partIds);
 					for (WoPage wopage : wos) {
@@ -143,12 +153,15 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchWidget(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchWidget(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				Business business = new Business(emc);
-				List<String> ids = business.widget().listWithPortals(appIdList);
+				List<String> ids = designerIdList;
+				if(ListTools.isEmpty(ids)) {
+					ids = business.widget().listWithPortals(appIdList);
+				}
 				for (List<String> partIds : ListTools.batch(ids, 100)) {
 					List<WoWidget> wos = emc.fetchIn(Widget.class, WoWidget.copier, WoWidget.id_FIELDNAME, partIds);
 					for (WoWidget woWidget : wos) {

+ 28 - 16
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -47,14 +47,19 @@ class ActionSearch extends BaseAction {
 
 		List<Wo> resWos = new ArrayList<>();
 		List<CompletableFuture<List<Wo>>> list = new ArrayList<>();
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.form.toString())){
-			list.add(searchForm(wi, wi.getAppIdList()));
+		Map<String, List<String>> designerMap = wi.getAppDesigner();
+		List<String> appList = wi.getAppIdList();
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.form.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.form.toString()))){
+			list.add(searchForm(wi, appList, designerMap.get(DesignerType.form.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString())){
-			list.add(searchScript(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.script.toString()))){
+			list.add(searchScript(wi, appList, designerMap.get(DesignerType.script.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.process.toString())){
-			resWos.addAll(searchProcess(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.process.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.process.toString()))){
+			resWos.addAll(searchProcess(wi, appList, designerMap.get(DesignerType.process.toString())));
 		}
 		for (CompletableFuture<List<Wo>> cf : list){
 			if(resWos.size()<50) {
@@ -69,15 +74,17 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchScript(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoScript> woScripts;
-				if (ListTools.isEmpty(appIdList)) {
-					woScripts = emc.fetchAll(Script.class, WoScript.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woScripts = emc.fetchIn(Script.class, WoScript.copier, Script.application_FIELDNAME, appIdList);
+				} else {
+					woScripts = emc.fetchAll(Script.class, WoScript.copier);
 				}
 				for (WoScript woScript : woScripts) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoScript.copier.getCopyFields(), woScript, wi.getKeyword(),
@@ -106,12 +113,15 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchForm(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchForm(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				Business business = new Business(emc);
-				List<String> formIds = business.form().listWithApplications(appIdList);
+				List<String> formIds = designerIdList;
+				if(ListTools.isEmpty(formIds)) {
+					formIds = business.form().listWithApplications(appIdList);
+				}
 				for (List<String> partFormIds : ListTools.batch(formIds, 100)) {
 					List<WoForm> woForms = emc.fetchIn(Form.class, WoForm.copier, Form.id_FIELDNAME, partFormIds);
 					for (WoForm woForm : woForms) {
@@ -143,12 +153,14 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private List<Wo> searchProcess(final Wi wi, final List<String> appIdList) {
-
+	private List<Wo> searchProcess(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		List<List<String>> batchList = new ArrayList<>();
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			Business business = new Business(emc);
-			List<String> processIds = business.process().listWithApplications(appIdList);
+			List<String> processIds = designerIdList;
+			if(ListTools.isEmpty(processIds)) {
+				Business business = new Business(emc);
+				processIds = business.process().listWithApplications(appIdList);
+			}
 			batchList = ListTools.batch(processIds, 20);
 		}catch (Exception e){
 			logger.error(e);

+ 22 - 9
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/designer/ActionSearch.java

@@ -43,12 +43,15 @@ class ActionSearch extends BaseAction {
 
 		List<Wo> resWos = new ArrayList<>();
 		List<CompletableFuture<List<Wo>>> list = new ArrayList<>();
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString())){
-			if(wi.getAppIdList().isEmpty() || wi.getAppIdList().contains("invoke")) {
-				list.add(searchInvoke(wi));
+		Map<String, List<String>> designerMap = wi.getAppDesigner();
+		List<String> appList = wi.getAppIdList();
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.script.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.script.toString()))){
+			if(appList.isEmpty() || appList.contains("invoke")) {
+				list.add(searchInvoke(wi, designerMap.get(DesignerType.script.toString())));
 			}
-			if(wi.getAppIdList().isEmpty() || wi.getAppIdList().contains("agent")) {
-				list.add(searchAgent(wi));
+			if(appList.isEmpty() || appList.contains("agent")) {
+				list.add(searchAgent(wi, designerMap.get(DesignerType.script.toString())));
 			}
 		}
 		for (CompletableFuture<List<Wo>> cf : list){
@@ -64,11 +67,16 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private CompletableFuture<List<Wo>> searchAgent(final Wi wi) {
+	private CompletableFuture<List<Wo>> searchAgent(final Wi wi, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-				List<WoAgent> woAgents = emc.fetchAll(Agent.class, WoAgent.copier);
+				List<WoAgent> woAgents;
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woAgents = emc.fetchIn(Agent.class, WoAgent.copier, Agent.id_FIELDNAME, designerIdList);
+				} else {
+					woAgents = emc.fetchAll(Agent.class, WoAgent.copier);
+				}
 				for (WoAgent woAgent : woAgents) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoAgent.copier.getCopyFields(), woAgent, wi.getKeyword(),
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
@@ -93,11 +101,16 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchInvoke(final Wi wi) {
+	private CompletableFuture<List<Wo>> searchInvoke(final Wi wi, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-				List<WoInvoke> woInvokes = emc.fetchAll(Invoke.class, WoInvoke.copier);
+				List<WoInvoke> woInvokes;
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woInvokes = emc.fetchIn(Invoke.class, WoInvoke.copier, Invoke.id_FIELDNAME, designerIdList);
+				} else {
+					woInvokes = emc.fetchAll(Invoke.class, WoInvoke.copier);
+				}
 				for (WoInvoke woInvoke : woInvokes) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoInvoke.copier.getCopyFields(), woInvoke, wi.getKeyword(),
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());

+ 40 - 24
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -46,18 +46,26 @@ class ActionSearch extends BaseAction {
 
 		List<Wo> resWos = new ArrayList<>();
 		List<CompletableFuture<List<Wo>>> list = new ArrayList<>();
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.view.toString())){
-			list.add(searchView(wi, wi.getAppIdList()));
+		Map<String, List<String>> designerMap = wi.getAppDesigner();
+		List<String> appList = wi.getAppIdList();
+
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.view.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.view.toString()))){
+			list.add(searchView(wi, appList, designerMap.get(DesignerType.view.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.table.toString())){
-			list.add(searchTable(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.table.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.table.toString()))){
+			list.add(searchTable(wi, appList, designerMap.get(DesignerType.table.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.statement.toString())){
-			list.add(searchStatement(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.statement.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.statement.toString()))){
+			list.add(searchStatement(wi, appList, designerMap.get(DesignerType.statement.toString())));
 		}
-		if (wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.stat.toString())){
-			list.add(searchStat(wi, wi.getAppIdList()));
+		if ((wi.getDesignerTypes().isEmpty() || wi.getDesignerTypes().contains(DesignerType.stat.toString()))
+				&& (designerMap.isEmpty() || designerMap.containsKey(DesignerType.stat.toString()))){
+			list.add(searchStat(wi, appList, designerMap.get(DesignerType.stat.toString())));
 		}
+
 		for (CompletableFuture<List<Wo>> cf : list){
 			if(resWos.size()<50) {
 				resWos.addAll(cf.get(60, TimeUnit.SECONDS));
@@ -71,15 +79,17 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private CompletableFuture<List<Wo>> searchView(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchView(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoView> woViews;
-				if (ListTools.isEmpty(appIdList)) {
-					woViews = emc.fetchAll(View.class, WoView.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woViews = emc.fetchIn(View.class, WoView.copier, View.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woViews = emc.fetchIn(View.class, WoView.copier, View.query_FIELDNAME, appIdList);
+				} else {
+					woViews = emc.fetchAll(View.class, WoView.copier);
 				}
 				for (WoView woView : woViews) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoView.copier.getCopyFields(), woView, wi.getKeyword(),
@@ -108,15 +118,17 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchTable(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchTable(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoTable> woTables;
-				if (ListTools.isEmpty(appIdList)) {
-					woTables = emc.fetchAll(Table.class, WoTable.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woTables = emc.fetchIn(Table.class, WoTable.copier, Table.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woTables = emc.fetchIn(Table.class, WoTable.copier, Table.query_FIELDNAME, appIdList);
+				} else {
+					woTables = emc.fetchAll(Table.class, WoTable.copier);
 				}
 				for (WoTable woTable : woTables) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoTable.copier.getCopyFields(), woTable, wi.getKeyword(),
@@ -145,15 +157,17 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchStat(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchStat(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoStat> woStats;
-				if (ListTools.isEmpty(appIdList)) {
-					woStats = emc.fetchAll(Stat.class, WoStat.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woStats = emc.fetchIn(Stat.class, WoStat.copier, Stat.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woStats = emc.fetchIn(Stat.class, WoStat.copier, Stat.query_FIELDNAME, appIdList);
+				} else {
+					woStats = emc.fetchAll(Stat.class, WoStat.copier);
 				}
 				for (WoStat woStat : woStats) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoStat.copier.getCopyFields(), woStat, wi.getKeyword(),
@@ -182,15 +196,17 @@ class ActionSearch extends BaseAction {
 		return cf;
 	}
 
-	private CompletableFuture<List<Wo>> searchStatement(final Wi wi, final List<String> appIdList) {
+	private CompletableFuture<List<Wo>> searchStatement(final Wi wi, final List<String> appIdList, final List<String> designerIdList) {
 		CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
 			List<Wo> resWos = new ArrayList<>();
 			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 				List<WoStatement> woStatements;
-				if (ListTools.isEmpty(appIdList)) {
-					woStatements = emc.fetchAll(Statement.class, WoStatement.copier);
-				} else {
+				if (ListTools.isNotEmpty(designerIdList)) {
+					woStatements = emc.fetchIn(Statement.class, WoStatement.copier, Statement.id_FIELDNAME, designerIdList);
+				}else if (ListTools.isNotEmpty(appIdList)) {
 					woStatements = emc.fetchIn(Statement.class, WoStatement.copier, Statement.query_FIELDNAME, appIdList);
+				} else {
+					woStatements = emc.fetchAll(Statement.class, WoStatement.copier);
 				}
 				for (WoStatement woStatement : woStatements) {
 					Map<String, String> map = PropertyTools.fieldMatchKeyword(WoStatement.copier.getCopyFields(), woStatement, wi.getKeyword(),

+ 18 - 18
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java

@@ -37,27 +37,27 @@ class ActionSearch extends BaseAction {
 	}
 
 	private Wo search(final Wi wi) {
-		final Map<String, List<String>> moduleMap = new HashMap<>();
+		final Map<String, List<WiDesigner.ModuleApp>> moduleMap = new HashMap<>();
 		if(!ListTools.isEmpty(wi.getModuleList())){
 			for (Module module: wi.getModuleList()){
 				if(module.getModuleType().equalsIgnoreCase(ModuleType.cms.toString())){
-					moduleMap.put(ModuleType.cms.toString(), module.getFlagList());
+					moduleMap.put(ModuleType.cms.toString(), module.getModuleAppList());
 				}
 				if(module.getModuleType().equalsIgnoreCase(ModuleType.portal.toString())){
-					moduleMap.put(ModuleType.portal.toString(), module.getFlagList());
+					moduleMap.put(ModuleType.portal.toString(), module.getModuleAppList());
 				}
 				if(module.getModuleType().equalsIgnoreCase(ModuleType.processPlatform.toString())){
-					moduleMap.put(ModuleType.processPlatform.toString(), module.getFlagList());
+					moduleMap.put(ModuleType.processPlatform.toString(), module.getModuleAppList());
 				}
 				if(module.getModuleType().equalsIgnoreCase(ModuleType.query.toString())){
-					moduleMap.put(ModuleType.query.toString(), module.getFlagList());
+					moduleMap.put(ModuleType.query.toString(), module.getModuleAppList());
 				}
 				if(module.getModuleType().equalsIgnoreCase(ModuleType.service.toString())){
-					moduleMap.put(ModuleType.service.toString(), module.getFlagList());
+					moduleMap.put(ModuleType.service.toString(), module.getModuleAppList());
 				}
 			}
 		}else{
-			List<String> list = new ArrayList<>();
+			List<WiDesigner.ModuleApp> list = new ArrayList<>();
 			moduleMap.put(ModuleType.cms.toString(), list);
 			moduleMap.put(ModuleType.portal.toString(), list);
 			moduleMap.put(ModuleType.processPlatform.toString(), list);
@@ -99,14 +99,14 @@ class ActionSearch extends BaseAction {
 		return wo;
 	}
 
-	private CompletableFuture<List<WrapDesigner>> searchAsync(final Wi wi, final Map<String, List<String>> moduleMap, final String moduleType, final Class<?> applicationClass, Executor executor){
+	private CompletableFuture<List<WrapDesigner>> searchAsync(final Wi wi, final Map<String, List<WiDesigner.ModuleApp>> moduleMap, final String moduleType, final Class<?> applicationClass, Executor executor){
 		CompletableFuture<List<WrapDesigner>> cf = CompletableFuture.supplyAsync(() -> {
 			List<WrapDesigner> swList = new ArrayList<>();
 			if(moduleMap.containsKey(moduleType)) {
 				try {
 					WiDesigner wiDesigner = new WiDesigner();
 					BeanUtils.copyProperties(wiDesigner, wi);
-					wiDesigner.setAppIdList(moduleMap.get(moduleType));
+					wiDesigner.setModuleAppList(moduleMap.get(moduleType));
 					List<WrapDesigner> designerList = ThisApplication.context().applications().postQuery(applicationClass,
 							Applications.joinQueryUri("designer", "search"), wiDesigner).getDataAsList(WrapDesigner.class);
 					logger.info("设计搜索关联{}的匹配设计个数:{}", moduleType, designerList.size());
@@ -146,7 +146,7 @@ class ActionSearch extends BaseAction {
 
 		@FieldDescribe("搜索关键字.")
 		private String keyword;
-		@FieldDescribe("搜索设计类型:script|form|page|widget|process")
+		@FieldDescribe("搜索设计类型:script|form|page|widget|process|view|table|stat|statement")
 		private List<String> designerTypes;
 		@FieldDescribe("是否区分大小写.")
 		private Boolean caseSensitive;
@@ -154,8 +154,8 @@ class ActionSearch extends BaseAction {
 		private Boolean matchWholeWord;
 		@FieldDescribe("是否正则表达式匹配.")
 		private Boolean matchRegExp;
-		@FieldDescribe("限制查询的模块列表(模块类型:processPlatform|cms|portal|query|service).")
-		@FieldTypeDescribe(fieldType = "class", fieldTypeName = "Module", fieldValue = "{\"moduleType\": \"cms\", \"flagList\": []}")
+		@FieldDescribe("限制查询的模块列表(模块类型:processPlatform|cms|portal|query|service)<br/>\r\n")
+		@FieldTypeDescribe(fieldType = "class", fieldTypeName = "Module", fieldValue = "{\"moduleType\": \"processPlatform\", \"moduleAppList\": [{\"appId\":\"\", \"designerList\": [{\"designerType\":\"process\", \"designerIdList\": []}]}]}")
 		private List<Module> moduleList;
 
 		public String getKeyword() {
@@ -208,17 +208,17 @@ class ActionSearch extends BaseAction {
 	}
 
 	public static class Module extends GsonPropertyObject {
-		@FieldDescribe("模块的应用id列表.")
-		private List<String> flagList;
+		@FieldDescribe("模块的应用列表.")
+		private List<WiDesigner.ModuleApp> moduleAppList = new ArrayList<>();
 		@FieldDescribe("模块类型.")
 		private String moduleType;
 
-		public List<String> getFlagList() {
-			return flagList == null ? new ArrayList<>() : flagList;
+		public List<WiDesigner.ModuleApp> getModuleAppList() {
+			return moduleAppList;
 		}
 
-		public void setFlagList(List<String> flagList) {
-			this.flagList = flagList;
+		public void setModuleAppList(List<WiDesigner.ModuleApp> moduleAppList) {
+			this.moduleAppList = moduleAppList;
 		}
 
 		public String getModuleType() {

+ 0 - 6
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/DesignAction.java

@@ -17,7 +17,6 @@ import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.container.Suspended;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import java.util.concurrent.locks.ReentrantLock;
 
 @Path("design")
 @JaxrsDescribe("全平台设计")
@@ -25,8 +24,6 @@ public class DesignAction extends StandardJaxrsAction {
 
 	private static Logger logger = LoggerFactory.getLogger(DesignAction.class);
 
-	private static ReentrantLock lock = new ReentrantLock();
-
 	@JaxrsMethodDescribe(value = "全平台设计搜索.", action = ActionSearch.class)
 	@POST
 	@Path("search")
@@ -36,14 +33,11 @@ public class DesignAction extends StandardJaxrsAction {
 					   JsonElement jsonElement) {
 		ActionResult<ActionSearch.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
-		lock.lock();
 		try {
 			result = new ActionSearch().execute(effectivePerson, jsonElement);
 		} catch (Exception e) {
 			logger.error(e, effectivePerson, request, null);
 			result.error(e);
-		} finally {
-			lock.unlock();
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}