duheng
2025-03-12 cec8d92bdca1da0b2eafe6eb3130f4bf6f03028b
Application/HStation.Application.PhartRelation.Core/01-relation/PhartDiagramRelation_Controller.cs
@@ -73,7 +73,7 @@
            var list = _service.GetTupleByIds(ids);
            var vm_list = list?.Select(x => new PhartDiagramRelationExtensionsDto(x.Item1, x.Item2, x.Item3)).ToList();
            return vm_list;
        }
        }
        /// <summary>
        /// 通过 DiagramID 获取
@@ -98,19 +98,31 @@
            var vmList = list?.Select(x => new PhartDiagramRelationDto(x)).ToList();
            return vmList;
        }
        /// <summary>
        /// 通过 ObjectType ObjectID 获取
        /// </summary>
        [Route("GetExByObjectTypeAndObjectID@V1.0")]
        [HttpGet]
        public List<PhartDiagramRelationExtensionsDto> GetExByObjectTypeAndObjectID([FromQuery][Required] ObjectInput input)
        {
            var list = _service.GetTupleByObjectTypeAndObjectID(input.ObjectType, input.ObjectID);
            var vmList = list?.Select(x => new PhartDiagramRelationExtensionsDto(x.Item1, x.Item2, x.Item3)).ToList();
            return vmList;
        }
        /// <summary>
        /// 通过 ObjectType ObjectID 获取 Default
        /// </summary>
        [Route("GetDefaultExByObjectTypeAndObjectID@V1.0")]
        [HttpGet]
        public PhartDiagramRelationExtensionsDto GetDefaultExByObjectTypeAndObjectID([FromQuery][Required] ObjectInput input)
        {
        {
            var dto = _service.GetTupleDefaultByObjectTypeAndObjectID(input.ObjectType, input.ObjectID);
            if (dto == null)
                return default;
            return new PhartDiagramRelationExtensionsDto(dto.Item1, dto.Item2, dto.Item3);
        }
        /// <summary>
@@ -151,7 +163,7 @@
        [Route("InsertEx@V1.0")]
        [HttpPost]
        public long InsertEx([Required] PhartDiagramRelationExtensionsDto input)
        {
        {
            var modelRelation = input.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = input.Diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = input.Diagram?.GraphList.Adapt<List<Yw.Model.PhartGraph>>();
@@ -174,12 +186,12 @@
            if (model == null)
            {
                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在");
            }
            }
            var rhs = new Model.PhartDiagramRelation(model);
            input.Adapt(rhs);
            var bol = _service.Update(rhs);
            return bol;
        }
        }
        /// <summary>
        /// 更新拓展
@@ -187,12 +199,12 @@
        [Route("UpdateEx@V1.0")]
        [HttpPut]
        public bool UpdateEx([Required] PhartDiagramRelationExtensionsDto input)
        {
        {
            var modelRelation = input.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = input.Diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = input.Diagram?.GraphList.Adapt<List<Yw.Model.PhartGraph>>();
            var bol = _service.UpdateEx(modelRelation, modelDiagram, modelGraphList);
            return bol;
            return bol;
        }
        /// <summary>
@@ -254,11 +266,10 @@
        {
            var bol = _service.UpdateDescription(input.ID, input.Description);
            return bol;
        }
        }
        #endregion Update
        #region Delete
@@ -300,13 +311,13 @@
        [Route("DeleteByDiagramID@V1.0")]
        [HttpDelete]
        public bool DeleteByDiagramID([FromQuery][Required] DiagramIDInput input)
        {
        {
            var bol = _service.DeleteByDiagramID(input.DiagramID, out string msg);
            if (!bol)
            {
                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, msg);
            }
            return true;
            return true;
        }