From 786e77b50e5a7676c3006506b34d14df3bb3c1fa Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 5 Aug 2024 10:25:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=9F=A5=E8=AF=A2where=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/GainfoService.cs | 20 +++++++++---------- .../Services/Implements/GainfoStore.cs | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) 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; } - }