Browse Source

返回附件ID

qinchaoyue 3 weeks ago
parent
commit
23a227701b

+ 2 - 0
src/Hotline.Application/Snapshot/IndustryApplication.cs

@@ -99,6 +99,8 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
         var files = await _fileRepository.GetByKeyAsync(id, token);
         var files = await _fileRepository.GetByKeyAsync(id, token);
         var outDto = industry.Adapt<IndustryDetailOutDto>();
         var outDto = industry.Adapt<IndustryDetailOutDto>();
         outDto.Files = files.Adapt<IList<IndustryFileDto>>();
         outDto.Files = files.Adapt<IList<IndustryFileDto>>();
+        if (outDto.Files.NotNullOrEmpty())
+            outDto.Files.ToList().ForEach(m => m.AdditionId = m.Key);
         return outDto;
         return outDto;
     }
     }
 
 

+ 9 - 0
test/Hotline.Tests/Application/IndustryApplicationTest.cs

@@ -18,6 +18,7 @@ using Hotline.ThirdAccountDomainServices;
 using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Snapshot.IRepository;
 using Hotline.Snapshot.IRepository;
 using Hotline.Application.Snapshot.Contracts;
 using Hotline.Application.Snapshot.Contracts;
+using Hotline.Application.Snapshot;
 
 
 namespace Hotline.Tests.Application;
 namespace Hotline.Tests.Application;
 public class IndustryApplicationTest : TestBase
 public class IndustryApplicationTest : TestBase
@@ -41,6 +42,14 @@ public class IndustryApplicationTest : TestBase
         items.ShouldNotBeNull();
         items.ShouldNotBeNull();
     }
     }
 
 
+    [Fact]
+    public async Task GetIndustryDetail_Test()
+    {
+        var industry = await _industryApplication.GetIndustres(new IndustryListInDto("电气焊", null)).FirstAsync();
+        var detail = await _industryApplication.GetIndustryDetailAsync(industry.Id, CancellationToken.None);
+        detail.Name.ShouldNotBeNull();
+    }
+
     [Fact]
     [Fact]
     public async Task UpdateIndustry_Test()
     public async Task UpdateIndustry_Test()
     {
     {