From 03a5421fbeb184679908b4050e39aba619c9aa42 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 8 Jan 2025 18:03:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=A6=BB=E8=81=8C=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 | 55 ++++++------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 2093245e..9e2aad47 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -131,43 +131,24 @@ public class GainfoService : IGainfoService CardType = gainfo.CardType, CardTypeName = type.Display }, true) - : request.Status == GainfoStatusEnumType.Working - ? _dbContext.Queryable() - .WhereIF(request.SearchType.HasValue, where) - .LeftJoin((gainfo, department) => gainfo.DepartmentNo == department.No) - .LeftJoin((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod") - .WhereIF(request.SearchType.HasValue == false, gainfo => 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) - .OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排 - .Select((gainfo, department, type) => new GainfoPageResponse - { - DepartmentName = department.Name, - CardType = gainfo.CardType, - CardTypeName = type.Display - }, true) - : _dbContext.Queryable().AS("GainfoLeave") - .WhereIF(request.SearchType.HasValue, where) - .LeftJoin((gainfo, department) => gainfo.DepartmentNo == department.No) - .LeftJoin((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod") - .WhereIF(request.SearchType.HasValue == false, gainfo => 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) - .OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排 - .Select((gainfo, department, type) => new GainfoPageResponse - { - DepartmentName = department.Name, - CardType = gainfo.CardType, - CardTypeName = type.Display - }, true); + : _gainfoStore.Queryable(request.Status) + .WhereIF(request.SearchType.HasValue, where) + .LeftJoin((gainfo, department) => gainfo.DepartmentNo == department.No) + .LeftJoin((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod") + .WhereIF(request.SearchType.HasValue == false, gainfo => 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) + .OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排 + .Select((gainfo, department, type) => new GainfoPageResponse + { + DepartmentName = department.Name, + CardType = gainfo.CardType, + CardTypeName = type.Display + }, true); var page = await queryable.ToPageListAsync(request);