mapper_bt-company_sql__responsefield.json

1、关键列:searchFieldRemoves 多个,分割

{
  "responseField": {
    "manager": {
      // #region 特殊_mapperType 参数设置
      "mappers": {
        "1": {
          "searchColumnRemoves": "push_name",
          "searchFieldRemoves": "pushName"
        }
      },
      // #endregion 特殊_mapperType 参数设置
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion",
      "searchColumnRemoves": "push_name",
      "searchFieldRemoves": "pushName",
      // #endregion 移除多余字段
      // #region 5分钟内数据置顶
      "order": "{date_diff_sort},sort_id",
      "field": {
        "sort": {
          "createTime": {
            "column": "create_time",
            "dateDiffMinute": 5
          }
        }
      }
      // #endregion 5分钟内数据置顶
    },
    "manager_detail": {
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion"
      // #endregion 移除多余字段
    }
  }
}

核心代码

\RG3.BO.BI.Bridge\Controller\BridgeController.cs

   Dictionary<string, BridgeItemConfig> dicSearchColumns = new Dictionary<string, BridgeItemConfig>();
            if (bridgeConfig.Search != null && bridgeConfig.Search.Columns != null)
            {
                // #region 移除多余搜索字段  先来源参数 _mapperType
                string searchColumnRemovesV = null;
                string searchFieldRemovesV = null;
                var mapperType = RequestPFUtil.GetMapperType(dictionaryUrl);
                if (mapperType != null && rf.Mappers != null && rf.Mappers.ContainsKey(mapperType))
                {
                    searchColumnRemovesV = rf.Mappers[mapperType]?.SearchColumnRemoves;
                }
                if (mapperType != null && rf.Mappers != null && rf.Mappers.ContainsKey(mapperType))
                {
                    searchFieldRemovesV = rf.Mappers[mapperType]?.SearchFieldRemoves;
                }
                if (searchColumnRemovesV == null)
                {
                    searchColumnRemovesV = rf.SearchColumnRemoves;
                }
                if (searchFieldRemovesV == null)
                {
                    searchFieldRemovesV = rf.SearchFieldRemoves;
                }

                bool showColumnRemoves = ValidateUtil.ValidateExistsValue(searchColumnRemovesV);
                List<string> lstShowColumnRemoves = new List<string>();
                if (showColumnRemoves)
                {
                    lstShowColumnRemoves = searchColumnRemovesV.Split(',').ToList();
                }
                bool showFieldRemoves = ValidateUtil.ValidateExistsValue(searchFieldRemovesV);
                List<string> lstShowFieldRemoves = new List<string>();
                if (showFieldRemoves)
                {
                    lstShowFieldRemoves = searchFieldRemovesV.Split(',').ToList();
                }
                // #endregion 移除多余搜索字段
                //.OrderBy(temp => temp.Value.SortId)
                var items = bridgeConfig.Search.Columns;
                foreach (var item in items)
                {
                    if (item.Value.Enabled == false) continue;
                    // #region 移除多余搜索字段
                    if (showColumnRemoves && lstShowColumnRemoves.Contains(item.Key)) continue;
                    if (showFieldRemoves && lstShowFieldRemoves.Contains(item.Key)) continue;
                    // #endregion 移除多余搜索字段

                    dicSearchColumns[item.Key] = item.Value;
                }
                bridgeConfig.Search.Columns = dicSearchColumns;
            }
文档更新时间: 2022-08-21 12:37   作者:admin