Пример #1
0
        public IActionResult GetAttributes(Guid id)
        {
            var queryView = _queryViewFinder.FindById(id);

            if (queryView == null)
            {
                return(NotFound());
            }
            var queryExp = new QueryExpression().DeserializeFromJson(queryView.FetchConfig);
            var result   = _queryMetadataFinder.GetAttributes(queryExp);

            return(JOk(result));
        }
Пример #2
0
        public bool Create(Domain.QueryView entity)
        {
            //依赖于字段
            var queryExp           = new QueryExpression().DeserializeFromJson(entity.FetchConfig);
            var requiredAttributes = _queryMetadataFinder.GetAttributes(queryExp);

            _dependencyService.Create(QueryViewDefaults.ModuleName, entity.QueryViewId, AttributeDefaults.ModuleName, requiredAttributes.Select(x => x.AttributeId).ToArray());

            //依赖于按钮
            if (entity.IsCustomButton && entity.CustomButtons.IsNotEmpty())
            {
                var buttonIds = new Guid[] { }.DeserializeFromJson(entity.CustomButtons);
                if (buttonIds.NotEmpty())
                {
                    _dependencyService.Create(QueryViewDefaults.ModuleName, entity.QueryViewId, RibbonButtonDefaults.ModuleName, buttonIds);
                }
            }
            return(true);
        }