ÎļþÃû´Ó Application/IStation.Application4Basic/attachment_file/AttachmentFile_StandardController.cs ÐÞ¸Ä |
| | |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | |
| | | /// </summary> |
| | | [Route("Basic/AttachmentFile")] |
| | | [ApiDescriptionSettings("Basic", Name = "éä»¶", Order = 100)] |
| | | public class AttachmentFile_StandardController : IDynamicApiController |
| | | public class AttachmentFile_Controller : IDynamicApiController |
| | | { |
| | | private readonly Service.AttachmentFile _service = new Service.AttachmentFile(); |
| | | |
| | |
| | | [HttpDelete] |
| | | public DeleteReasonOutput DeleteByID([FromQuery][Required] IDUnderCorpInput input) |
| | | { |
| | | var model = _service.GetByID(input.CorpID,input.ID); |
| | | if (model == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"ID:{input.ID}"); |
| | | } |
| | | var bol = _service.DeleteByID(input.CorpID, input.ID, out string Msg); |
| | | if (bol) |
| | | { |
| | | FileHelper.Delete(model.StorageHouse,model.StorageCode); |
| | | } |
| | | return new DeleteReasonOutput() { Success = bol, Reason = Msg }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ AttachType å AttachID å é¤ |
| | | /// </summary> |
| | | [Route("DeleteByAttachTypeAndAttachID@V1.0")] |
| | | [HttpDelete] |
| | | public DeleteReasonOutput DeleteByAttachTypeAndAttachID([FromQuery][Required] AttachmentUnderCorpInput input) |
| | | { |
| | | var list = _service.GetByAttachTypeAndAttachID(input.CorpID,input.AttachType,input.AttachID); |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"AttachType:{input.AttachType},AttachID:{input.AttachID}"); |
| | | } |
| | | var bol = _service.DeleteByAttachTypeAndAttachID(input.CorpID, input.AttachType,input.AttachID, out string Msg); |
| | | if (bol) |
| | | { |
| | | list.ForEach(x=>FileHelper.Delete(x.StorageHouse,x.StorageCode)); |
| | | } |
| | | return new DeleteReasonOutput() { Success = bol, Reason = Msg }; |
| | | } |
| | | |