\RG3.BO.Op\Provider\SaveExtendProvider.cs

"saveSqlExtand": {
    "bo-user-share": {
      "sortId": 1,
      //#region  如果参数里面其中之一不为null,语句执行
      "need": [
        {
          "field": "_userFromFirstShareId",
          "value": "null"
        },
        {
          "field": "_userFromSecondShareId",
          "value": "null"
        }
      ],
      //#endregion 
      "sqlUpdate": null,
      "sqlInsert": "insert into bo_user_share (from_first_share_id,from_second_share_id,user_id,share_status,create_date,modify_date) values  (@_userFromFirstShareId,@_userFromSecondShareId,@userId,0,@_currentDate,@_currentDate);"
    }
  },
 "saveSqlExtand": {
   "activity-award-round": {
     "sortId": 79,
     "connName": "ConnAct",
     "sqlUpdate": "update activity_award_rels t,activity_lottery_round f set t.round_name=f.round_name where t.ar_id=@arId and t.round_id=f.round_id"
   },
   "activity-award-id": {
     "sortId": 89,
     "connName": "ConnAct",
     "sqlUpdate": "update activity_award_rels t,activity_award f set t.award_name=f.award_name where t.ar_id=@arId and t.award_id=f.award_id"
   },
   "activity-config": {
     "sortId": 100,
     "connName": "ConnAct",
     "sqlUpdate": "update activity_award_rels t,activity_config f set t.activity_name=f.activity_name where t.ar_id=@arId and t.activity_id=f.activity_id"
   },
   "activity-lottery-round": {
     "sortId": 100,
     "connName": "ConnAct",
     "sqlUpdate": "update activity_lottery_round t,(select sum(award_num) award_num,max(round_id) round_id from activity_award_rels where is_enabled=1 and round_id in (select round_id from activity_award_rels where ar_id=@arId)) f set t.award_num=f.award_num where t.round_id=f.round_id"
   }
 },

\RG3.BO.Op\Provider\SaveExtendProvider.cs


   /// <summary>
        /// 验证是否执行扩展
        /// </summary>
        /// <param name="lstDic"></param>
        /// <param name="sql"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        private bool ValidateDoResult(IEnumerable<Dictionary<string, object>> lstDic, string sql, SqlConfigSaveExtand item)
        {
            var dic = RegexUtil.ConvertDictionaryByMatch(sql);
            bool doResult = true;
            if (dic != null)
            {
                foreach (var itemT in dic)
                {
                    if (!lstDic.FirstOrDefault().ContainsKey(itemT.Key))
                    {
                        doResult = false;
                        break;
                    }
                }
            }
            if (doResult && item.Need != null && item.Need.Count() > 0)
            {
                doResult = false;
                foreach (var itemT in item.Need)
                {
                    var itemF = lstDic.FirstOrDefault();
                    if (ValidateUtil.IsNullOrEmptyOrDbNull(itemF[itemT.Field]) && itemF[itemT.Field].ToString() != itemT.Value)
                    {
                        doResult = true;
                        break;
                    }
                }
            }

            return doResult;
        }
文档更新时间: 2023-12-26 21:21   作者:admin