| | |
| | | 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 获取 |
| | |
| | | [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> |
| | |
| | | [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>>(); |
| | |
| | | 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> |
| | | /// 更新拓展 |
| | |
| | | [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> |
| | |
| | | { |
| | | var bol = _service.UpdateDescription(input.ID, input.Description); |
| | | return bol; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion Update |
| | | |
| | | |
| | | |
| | | #region Delete |
| | | |
| | |
| | | [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; |
| | | } |
| | | |
| | | |