From a57d5ef9a967801da1a12e2b150a70f1cead5f30 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 2 Jul 2025 14:44:16 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=A2=9E=E5=8A=A0=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=8E=82=E5=8C=BA/=E5=8F=98=E6=9B=B4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=92=E6=A1=A3=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenApi/Controllers/GainfosController.cs | 10 ++++++++ .../Request/GainfoArchivePageRequest.cs | 18 +++++++++++++ .../OpenApi/Services/IGainfoService.cs | 3 +++ .../Services/Implements/GainfoService.cs | 25 ++++++++++++++++++- 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 Src/Dlhis.External/OpenApi/Request/GainfoArchivePageRequest.cs diff --git a/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs index 0d4d6840..8834618a 100644 --- a/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs +++ b/Src/Dlhis.External/OpenApi/Controllers/GainfosController.cs @@ -47,6 +47,16 @@ public class GainfosController : ControllerBase return await _gainfoService.GetGainfosAsync(factory); } + /// + /// 获取归档人员数据 + /// + /// + [HttpGet("/archive/pagination")] + public async Task> GetGainfoLeavePageAsync([FromQuery] GainfoArchivePageRequest request) + { + return await _gainfoService.GetGainfoLeavePageAsync(request); + } + /// /// 获取考勤数据 /// diff --git a/Src/Dlhis.External/OpenApi/Request/GainfoArchivePageRequest.cs b/Src/Dlhis.External/OpenApi/Request/GainfoArchivePageRequest.cs new file mode 100644 index 00000000..028069d7 --- /dev/null +++ b/Src/Dlhis.External/OpenApi/Request/GainfoArchivePageRequest.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using Kurisu.AspNetCore.DataAccess.Dto; + +namespace Dlhis.External.OpenApi.Request; + +public class GainfoArchivePageRequest : PageDto +{ + /// + /// 厂区不能为空 + /// + [Required(ErrorMessage = "{0}厂区不能为空")] + public string Factory { get; set; } + + /// + /// 数据变更时间 + /// + public DateTime? ModifiedTime { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs index 1da9ed40..dd4d88e8 100644 --- a/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs +++ b/Src/Dlhis.External/OpenApi/Services/IGainfoService.cs @@ -14,4 +14,7 @@ public interface IGainfoService : IScopeDependency Task> GetAttendanceRecordPageAsync(DeviceUploadLogMyRecordRequest request); + + + Task> GetGainfoLeavePageAsync(GainfoArchivePageRequest request); } \ No newline at end of file diff --git a/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs index 45b2a43f..e52ece3d 100644 --- a/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.External/OpenApi/Services/Implements/GainfoService.cs @@ -56,7 +56,6 @@ public class GainfoService : IGainfoService .LeftJoin((x, d) => x.DepartmentNo == d.No) .Where(x => x.Factory == "2401") .Where(x => SqlFunc.Subqueryable() - .Where(p => p.Factory == "2401") .Where(p => p.Code == x.Code) .NotAny() ) @@ -128,4 +127,28 @@ public class GainfoService : IGainfoService }) .ToPageListAsync(request); } + + public async Task> GetGainfoLeavePageAsync(GainfoArchivePageRequest request) + { + return await _dbContext.Queryable().AS("GainfoLeave") + .LeftJoin((x, d) => x.DepartmentNo == d.No) + .Where(x => x.Factory == request.Factory) + .WhereIF(request.ModifiedTime.HasValue, x => x.ModifiedTime >= request.ModifiedTime) + .Where(x => SqlFunc.Subqueryable() + .Where(p => p.Code == x.Code) + .NotAny() + ) + .Select((x, d) => new GainfoOpenResponse + { + Code = x.Code, + Type = SqlFunc.IIF(x.Type == GainfoUserTypeEnumType.SecurityWhite, GainfoUserTypeEnumType.Normal, x.Type), + DepartmentNo = x.DepartmentNo, + DepartmentName = d.Name, + Name = x.Name, + Gender = x.Gender, + Factory = x.Factory, + Status = GainfoStatusEnumType.Leave, + }) + .ToPageListAsync(request); + } } \ No newline at end of file