/// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, DataAuthorizeRelationEntity relationEntity, List <DataAuthorizeConditionEntity> conditionEntityList)
 {
     try
     {
         cache.Remove(cacheKey + relationEntity.F_InterfaceId, CacheId.dataAuthorize);
         cache.Remove(cacheKey + keyValue, CacheId.dataAuthorize);
         dataAuthorizeService.SaveEntity(keyValue, relationEntity, conditionEntityList);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity(string keyValue, DataAuthorizeRelationEntity relationEntity, List <DataAuthorizeConditionEntity> conditionEntityList)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    relationEntity.Modify(keyValue);
                    db.Update(relationEntity);
                    db.Delete <DataAuthorizeConditionEntity>(t => t.F_DataAuthorizeRelationId == keyValue);
                }
                else
                {
                    relationEntity.Create();
                    db.Insert(relationEntity);
                }
                int sort = 0;
                foreach (var item in conditionEntityList)
                {
                    item.Create();
                    item.F_Sort = sort;
                    item.F_DataAuthorizeRelationId = relationEntity.F_Id;
                    db.Insert(item);
                    sort++;
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }