许鹏程
2024-08-15 55fbf527317eca0969a108831983a7b69e727939
src/main/java/com/product/face/entity/FaceListEntity.java
@@ -1,5 +1,6 @@
package com.product.face.entity;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.product.admin.config.CmnConst;
@@ -13,6 +14,7 @@
import com.product.core.entity.FieldSetEntity;
import com.product.core.spring.context.SpringBeanUtil;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.face.config.FaceConst;
import com.product.module.sys.entity.SystemUser;
import com.product.util.BaseUtil;
@@ -54,6 +56,31 @@
    * 表名
    */
   private String tableName;
   /**
    * 是否显示树
    */
   private String treeShow;
   /**
    * 树数据源类型
    */
   private String treeDataType;
   /**
    * 数据源
    */
   private String treeDataSource;
   /**
    * 树label key
    */
   private String treeLabelKey;
   /**
    * 树value key
    */
   private String treeValueKey;
   /**
    * 获取表名
@@ -147,6 +174,50 @@
      this.faceFields = faceFields;
   }
   public void setTableName(String tableName) {
      this.tableName = tableName;
   }
   public String getTreeShow() {
      return treeShow;
   }
   public void setTreeShow(String treeShow) {
      this.treeShow = treeShow;
   }
   public String getTreeDataType() {
      return treeDataType;
   }
   public void setTreeDataType(String treeDataType) {
      this.treeDataType = treeDataType;
   }
   public String getTreeDataSource() {
      return treeDataSource;
   }
   public void setTreeDataSource(String treeDataSource) {
      this.treeDataSource = treeDataSource;
   }
   public String getTreeLabelKey() {
      return treeLabelKey;
   }
   public void setTreeLabelKey(String treeLabelKey) {
      this.treeLabelKey = treeLabelKey;
   }
   public String getTreeValueKey() {
      return treeValueKey;
   }
   public void setTreeValueKey(String treeValueKey) {
      this.treeValueKey = treeValueKey;
   }
   /**
    * 获取参照条件
    *
@@ -217,12 +288,15 @@
         }
         //字段名称
         String fieldName = faceField.getFieldName();
         if (!StringUtils.isEmpty(fieldName)) {
            fieldName.trim();
         }
         if (aliasField != null && !StringUtils.isEmpty(fieldName)) {
            List<String> fieldAlias = aliasField.get(getTableName() + "." + fieldName);
            if (fieldAlias != null && fieldAlias.size() > 0) {
               String alias = fieldAlias.get(0);
               if (!StringUtils.isEmpty(alias)) {
                  fieldName = alias;
                  fieldName = alias.trim();
               }
            }
         }
@@ -244,7 +318,7 @@
               }
               FieldSetEntity ff = prompt.getFieldSetEntity(0);
               StringBuilder p = new StringBuilder();
               p.append(getFieldName(tableAlias, fieldName)).append("` in ").append(" ( SELECT `").append(ff.getString("value_field")).append("` FROM ").append(ff.getString("source_table"));
               p.append(getFieldName(tableAlias, fieldName)).append(" in ").append(" ( SELECT ").append(ff.getString("value_field")).append(" FROM ").append(ff.getString("source_table"));
               p.append(" WHERE ").append(ff.getString("view_fields")).append(" like concat('%','~val~','%') )");
               filters.add(p.toString());
               continue;
@@ -258,7 +332,7 @@
      //获取redis 起始key
      String faceListKey = SystemFaceService.FACE_LIST_KEY;
      //重新放入redis
      RedisUtil.set(faceListKey + getUuid(), this);
      RedisUtil.set(faceListKey + getUuid(), JSON.parseObject(JSON.toJSONString(this), com.product.admin.entity.FaceListEntity.class));
      return maps;
   }
@@ -351,4 +425,5 @@
   }
}