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();