From ac070bd08ba4cb6c1e3bf670db75b6a8e801b84b Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期一, 17 十一月 2025 18:00:30 +0800
Subject: [PATCH] 表单建模树优化
---
src/main/java/com/product/face/service/FaceListSearchService.java | 71 ++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/product/face/service/FaceListSearchService.java b/src/main/java/com/product/face/service/FaceListSearchService.java
index de1d08e..7a1f02e 100644
--- a/src/main/java/com/product/face/service/FaceListSearchService.java
+++ b/src/main/java/com/product/face/service/FaceListSearchService.java
@@ -1,5 +1,6 @@
package com.product.face.service;
+import com.alibaba.fastjson.JSON;
import com.product.common.lang.StringUtils;
import com.product.core.cache.util.RedisUtil;
import com.product.core.exception.BaseException;
@@ -18,7 +19,18 @@
*/
@Component
public class FaceListSearchService extends AbstractBaseService {
-
+
+ /**
+ * 涓嶇敤
+ * 鍒楄〃鍏抽敭瀛楁悳绱�
+ * @param aliasTable
+ * @param aliasField
+ * @param faceUuid
+ * @param faceNumber
+ * @param val
+ * @return
+ * @throws BaseException
+ */
public String getFaceListSearchFilter(Map<String, List<String>> aliasTable, Map<String, List<String>> aliasField, String faceUuid, String faceNumber, String val) throws BaseException {
if (StringUtils.isEmpty(val)) {
return "";
@@ -26,8 +38,8 @@
FaceListEntity face = null;
if (!StringUtils.isEmpty(faceNumber)) {
face = (FaceListEntity) RedisUtil.get(FaceConst.FACE_LIST_KEY + ":face-number" + faceNumber);
- } else if (!StringUtils.isEmpty(faceUuid)){
- face = (FaceListEntity) RedisUtil.get(FaceConst.FACE_LIST_KEY + faceUuid);
+ } else if (!StringUtils.isEmpty(faceUuid)) {
+ face = JSON.parseObject(JSON.toJSONString(RedisUtil.get(FaceConst.FACE_LIST_KEY + faceUuid)), FaceListEntity.class);
}
if (face != null) {
String tableAlias = null;
@@ -56,4 +68,57 @@
}
return "";
}
+ /**
+ * 鍒楄〃鍏抽敭瀛楁悳绱�
+ * @param aliasTable {"product_sys_staffs":["a"],"product_sys_users":["b"],"product_sys_job_posts":["e"],"product_sys_org_levels":["c","d"]}
+ * @param aliasField
+ * @param faceUuid
+ * @param faceNumber
+ * @param val
+ * @param tableOfField 琛ㄥ搴斿瓧娈� 濡傦細table_relate_fields = {
+ "product_sys_staffs": ["uuid", "staff_status", "staff_avatar", "show_name", "mobile_phone", "staff_status_save_value", "status_save_value"],
+ "product_sys_users": ["uuid1", "user_name", "user_id", "user_account", "status"],
+ "product_sys_job_posts": ["job_post_uuid"],
+ "product_sys_org_levels": ["uuid2", "uuid3", "org_level_uuid", "dept_uuid"]
+ }
+ * @return
+ * @throws BaseException
+ */
+ public String getFaceListSearchFilter(Map<String, List<String>> aliasTable, Map<String, List<String>> aliasField, String faceUuid, String faceNumber, String val, Map<String, List<String>> tableOfField) throws BaseException {
+ if (StringUtils.isEmpty(val)) {
+ return "";
+ }
+ FaceListEntity face = null;
+ if (!StringUtils.isEmpty(faceNumber)) {
+ face = (FaceListEntity) RedisUtil.get(FaceConst.FACE_LIST_KEY + ":face-number" + faceNumber);
+ } else if (!StringUtils.isEmpty(faceUuid)) {
+ face = JSON.parseObject(JSON.toJSONString(RedisUtil.get(FaceConst.FACE_LIST_KEY + faceUuid)), FaceListEntity.class);
+ }
+ if (face != null) {
+// String tableAlias = null;
+// String tableName = face.getTableName();
+// List<String> t = aliasTable.get(tableName);
+// if (t != null && t.size() > 0) {
+// tableAlias = t.get(0);
+// }
+ Map<String, List<String>> params = face.getFilters(aliasTable, aliasField,tableOfField);
+ List<String> fieldNames = params.get("fields");
+ List<String> filters = params.get("filter");
+ String filter = "";
+ for (int i = 0; i < fieldNames.size(); i++) {
+ if (i > 0) {
+ filter += " or ";
+ }
+ filter += " " + fieldNames.get(i) + " LIKE BINARY concat('%','" + val + "','%')";
+ }
+ for (int i = 0; i < filters.size(); i++) {
+ if (!"".equals(filter)) {
+ filter += " or ";
+ }
+ filter += filters.get(i).replace("~val~", val);
+ }
+ return "".equals(filter) ? "" : "( " + filter + " )";
+ }
+ return "";
+ }
}
--
Gitblit v1.9.2