diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index cc31e439..ec9c0dda 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -78,26 +78,26 @@ public class GainfoService : IGainfoService var today = DateTime.Today; - var page = await _gainfoStore.Queryable(request.Status) + var query = _gainfoStore.Queryable(request.Status) .WhereIF(request.SearchType != GainfoSearchEnumType.BusinessTrip && request.DepartmentSelections?.Any() == true, where) + .LeftJoin((gainfo, department) => gainfo.DepartmentNo == department.No) + .LeftJoin((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod") .WhereIF(request.SearchType != GainfoSearchEnumType.BusinessTrip && request.DepartmentSelections?.Any() == false, gainfo => factories.Contains(gainfo.Factory)) - .WhereIF(request.SearchType == GainfoSearchEnumType.Internal, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).NotAny()) - .WhereIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).Any()) + .WhereIF(request.SearchType == GainfoSearchEnumType.Internal, gainfo => SqlFunc.Subqueryable().Where(p => p.Code == gainfo.Code).NotAny()) + .WhereIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => SqlFunc.Subqueryable().Where(p => p.Code == gainfo.Code).Any()) .WhereIF(request.SearchType == GainfoSearchEnumType.BusinessTrip, gainfo => - SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code && factories.Contains(x.Destination) && SqlFunc.DateIsSame(x.BeginDate, today)).Any()) + SqlFunc.Subqueryable().Where(p => p.Code == gainfo.Code && factories.Contains(p.Destination) && SqlFunc.DateIsSame(p.BeginDate, today)).Any()) .WhereIF(request.Search.IsPresent(), gainfo => gainfo.Name.Contains(request.Search) || gainfo.Code == request.Search || gainfo.IdNo == request.Search) - .LeftJoin((x, department) => x.DepartmentNo == department.No) - .LeftJoin((x, department, type) => type.Code == x.CardType.ToString() && type.Type == "timeperiod") - .Select((x, department, type) => new GainfoPageResponse + .Select((gainfo, department, type) => new GainfoPageResponse { DepartmentName = department.Name, - CardType = x.CardType, + CardType = gainfo.CardType, CardTypeName = type.Display - }, true) - .ToPageListAsync(request); + }, true); + var page = await query.ToPageListAsync(request); //外包人员部门号处理 if (request.SearchType == GainfoSearchEnumType.Outsource) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs index 0e4b4451..5d7f9b32 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs @@ -84,5 +84,4 @@ public class GainfoStore : IGainfoStore return tableName; } - }