From f9ea61ba495a92f316195170dd2b33d7d832f469 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 26 Mar 2024 11:43:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/GainfoService.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 01cac923..9640d7f3 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -424,13 +424,9 @@ public class GainfoService : IGainfoService { var info = await _gainfoStore.Queryable(request.Status) .LeftJoin((ga, de) => ga.DepartmentNo == de.No) - .LeftJoin((ga, de, type) => ga.Native == type.Code && type.Type == "native") - .LeftJoin((ga, de, type, posi) => ga.Position == posi.Name) - .LeftJoin((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country") - .LeftJoin((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation") - .LeftJoin((ga, de, type, posi, type2, type3, type4) => ga.IdClass == type4.Code && type4.Type == "cls") + .LeftJoin((ga, de, pos) => ga.Position == pos.Name) .Where(ga => ga.No == request.No) - .Select((ga, de, type, posi, type2, type3, type4) => new GainfoDetailResponse + .Select((ga, de, pos) => new GainfoDetailResponse { No = ga.No, SapNo = ga.SapNo, @@ -440,26 +436,34 @@ public class GainfoService : IGainfoService IdClass = ga.IdClass, IdNo = ga.IdNo, Gender = ga.Gender, - NativeName = type.Display, Address = ga.Address, Birthday = ga.Birthday, Phone = ga.Phone, Position = ga.Position, - Grade = posi.Grade, + Grade = pos.Grade, Degree = ga.Degree, Werks = ga.Werks, CostId = ga.CostId, Marital = ga.Marital == "Single" ? "未婚" : "已婚", - CountryName = type2.Display, - NationName = type3.Display, - ClassName = type4.Display, + NativeName = ga.Native, + CountryName = ga.CountryNo, + NationName = ga.Nation, + ClassName = ga.IdClass, Factory = ga.Factory, OnboardingDate = ga.CreateTime, }) - .FirstAsync(); + .SingleAsync(); if (info != null) { + var searchTypes = new List() { "native", "country", "nation", "cls" }; + var types = await _dbContext.Queryable().Where(x => searchTypes.Contains(x.Type)).ToListAsync(); + + info.NativeName = types.Where(x => x.Type == "native").FirstOrDefault(x => x.Code == info.NativeName)?.Display; + info.CountryName = types.Where(x => x.Type == "country").FirstOrDefault(x => x.Code == info.CountryName)?.Display; + info.NationName = types.Where(x => x.Type == "nation").FirstOrDefault(x => x.Code == info.NationName)?.Display; + info.ClassName = types.Where(x => x.Type == "cls").FirstOrDefault(x => x.Code == info.ClassName)?.Display; + if (request.WithFace) { info.Face = await _dbContext.ChangeDb("face").Queryable().Where(x => x.UserCode == info.Code).Select(x => x.Face).SingleAsync();