2 커밋 b4d1f6115e ... 2cad7bb60e

작성자 SHA1 메시지 날짜
  qinchaoyue 2cad7bb60e Merge branch 'feature/snapshot' into test 6 시간 전
  qinchaoyue 4404a68d1e 修复过滤 6 시간 전
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      src/Hotline.Application/Snapshot/SnapshotUserApplication.cs

+ 6 - 3
src/Hotline.Application/Snapshot/SnapshotUserApplication.cs

@@ -106,10 +106,13 @@ public class SnapshotUserApplication : ISnapshotUserApplication, IScopeDependenc
     {
         var query = _citizenRepository.Queryable(includeDeleted: true)
             .LeftJoin<ThirdAccount>((citizen, third) => citizen.Id == third.ExternalId)
-            .LeftJoin<CitizenRelationSafetyType>((citizen, third, relation) => relation.CitizenId == citizen.Id)
+            .LeftJoin<CitizenRelationSafetyType>((citizen, third, relation) => relation.CitizenId == citizen.Id && relation.SafetyTypeId == dto.SafetyTypeId)
             .WhereIF(dto.PhoneNumber.NotNullOrEmpty(), (citizen, third) => citizen.PhoneNumber.Contains(dto.PhoneNumber))
-            .WhereIF(dto.SafetyTypeId.NotNullOrEmpty(), (citizen, third, relation) => relation.SafetyTypeId == dto.SafetyTypeId && relation.CitizenId == null)
-            .Select((citizen, third, relation) => new GetThirdCitizenOutDto { CitizenId = citizen.Id}, true);
+            .WhereIF(dto.SafetyTypeId.NotNullOrEmpty(), (citizen, third, relation) => relation.CitizenId == null)
+            .Select((citizen, third, relation) => new GetThirdCitizenOutDto 
+            {
+                CitizenId = citizen.Id
+            }, true);
 #if DEBUG
         var sql = query.ToSqlString();
 #endif