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