add 增加WorkGridCode优先使用

This commit is contained in:
2025-03-27 10:39:43 +08:00
parent f6b04b6ee1
commit 3592e4565e
2 changed files with 7 additions and 2 deletions

View File

@@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations;
using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.Dto; using Kurisu.AspNetCore.DataAccess.Dto;
@@ -6,6 +5,8 @@ namespace Dlhis.Basic.WorkGrids.Request;
public class WorkGridScheduleAttendancePageRequest : PageDto public class WorkGridScheduleAttendancePageRequest : PageDto
{ {
public Guid? WorkGridCode { get; set; }
public string UserCode { get; set; } public string UserCode { get; set; }
public DateTimePeriod DateTimePeriod { get; set; } public DateTimePeriod DateTimePeriod { get; set; }

View File

@@ -243,7 +243,11 @@ public class WorkGridScheduleService : IWorkGridScheduleService
public async Task<Pagination<WorkGridScheduleAttendancePageResponse>> GetAttendancePageAsync(WorkGridScheduleAttendancePageRequest request) public async Task<Pagination<WorkGridScheduleAttendancePageResponse>> GetAttendancePageAsync(WorkGridScheduleAttendancePageRequest request)
{ {
var jinkoCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode); var jinkoCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
var workGrid = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.LeaderUserCode == jinkoCode).SingleAsync(); var workGrid = await _dbContext.Queryable<WorkGridEntity>()
.WhereIF(request.WorkGridCode.HasValue, x => x.Code == request.WorkGridCode)
.WhereIF(request.WorkGridCode.HasValue == false, x => x.LeaderUserCode == jinkoCode)
.SingleAsync();
if (workGrid == null) if (workGrid == null)
{ {
return new Pagination<WorkGridScheduleAttendancePageResponse> return new Pagination<WorkGridScheduleAttendancePageResponse>