\Config\AppConfig{ownerId}\app_config.json

  "whereValues": {
    //默认条件值 值必须以  _whereValue 开头 pdy 派单员  sby 上报员  fxy 分析员
    // 多个值, 分割
    "_whereValueCpcPdyRoleId": "",
    "_whereValueCpcSbyRoleId": "",
    "_whereValueCpcFxyRoleId": "",
    //默认条件值 业务类别值
    "_whereValueCpcPdyUserType": "",
    "_whereValueCpcSbyUserType": "",
    "_whereValueCpcFxyUserType": ""
  },
  "whereSqls": {
    //默认条件值 值必须以  _whereValue 开头 pdy 派单员  sby 上报员  fxy 分析员 拼接的sql语句, mapper里面需要预留占位符号{_whereSqlCpcPdyRoleId}
    "_whereSqlCpcPdyRoleId": "",
    "_whereSqlCpcSbyRoleId": "",
    "_whereSqlCpcFxyRoleId": "",
    //默认条件值 业务类别值
    "_whereSqlCpcPdyUserType": "",
    "_whereSqlCpcSbyUserType": "",
    "_whereSqlCpcFxyUserType": ""
  },

使用 {_whereValueCpcPdyUserType}


userType in @_whereValueCpcPdyUserType

使用 {_whereSqlCpcFxyRoleId}

  {
  // {_whereSqlCpcFxyRoleId} 只来至 \Config\AppConfig\{ownerId}\app_config.json
  "value": " and product_task_id in (select product_task_id from cpc_product_task_user where ({_whereSqlCpcFxyUserType} {_whereSqlCpcFxyRoleId}) and status=7 and is_enabled=1)",
  "sortId": 50
  }

AuthProvider$Current.cs

   Dictionary<string, IEnumerable<string>> dictionaryWhere = new Dictionary<string, IEnumerable<string>>();
            root.GetSection("whereValues").Bind(dictionaryWhere);
            foreach (var item in dictionaryWhere)
            {
                if (!item.Key.StartsWith("_whereValue"))
                {
                    Console.WriteLine($"AppConfig/{pf.OwnerId}/app_config.json【whereValues】key【{item.Key}】必须以_whereValue开头");
                    continue;
                }
                if (!item.Value.Any()) continue;
                dictionaryPop[item.Key] = item.Value;
            }
            // #region  默认条件过滤,用于流程数据权限
            Dictionary<string, string> dictionaryWhereSql = new Dictionary<string, string>();
            root.GetSection("whereSqls").Bind(dictionaryWhereSql);
            foreach (var item in dictionaryWhereSql)
            {
                if (!item.Key.StartsWith("_whereSql"))
                {
                    Console.WriteLine($"AppConfig/{pf.OwnerId}/app_config.json【whereSqls】key【{item.Key}】必须以_whereSql开头");
                    continue;
                }
                if (string.IsNullOrEmpty(item.Value)) continue;
                dictionaryPop[item.Key] = item.Value;
            }
文档更新时间: 2022-07-26 07:30   作者:admin