diff --git a/YD_Event.Application/AppUser/AppUserService.cs b/YD_Event.Application/AppUser/AppUserService.cs index 30411c2..823c13a 100644 --- a/YD_Event.Application/AppUser/AppUserService.cs +++ b/YD_Event.Application/AppUser/AppUserService.cs @@ -8,7 +8,6 @@ namespace YD_Event.Application.AppUser; /// /// 普通用户服务 /// -[ApiDescriptionSettings("用户管理", Name = "AppUser", Order = 100)] public class AppUserService : BaseService, ITransient { private readonly ISqlSugarRepository _appUserRep; diff --git a/YD_Event.Application/EventRecord/Dtos/EventRecordDtos.cs b/YD_Event.Application/EventRecord/Dtos/EventRecordDtos.cs index d3fc8c7..184f67e 100644 --- a/YD_Event.Application/EventRecord/Dtos/EventRecordDtos.cs +++ b/YD_Event.Application/EventRecord/Dtos/EventRecordDtos.cs @@ -2,8 +2,26 @@ namespace YD_Event.Application.EventRecord.Dtos; public class EventRecordPageInput : Pagination { - public long? UserId { get; set; } // The AuthAccount ID to query records for + /// + /// 普通用户ID + /// + public long? AppUserId { get; set; } + + /// + /// 商户ID + /// + public long? MerchantId { get; set; } + + /// + /// 赛事名称 + /// public string? EventName { get; set; } + + /// + /// 报名状态 + /// + public int? RegistrationStatus { get; set; } + public DateTime? StartTime { get; set; } public DateTime? EndTime { get; set; } } @@ -17,6 +35,11 @@ public class EventRecordOutput public DateTime EndTime { get; set; } public int RegistrationStatus { get; set; } public long EventId { get; set; } + + // Additional fields for admin view + public string ContactName { get; set; } + public string ContactPhone { get; set; } + public string TeamName { get; set; } } public class CertificateOutput diff --git a/YD_Event.Application/EventRecord/EventRecordService.cs b/YD_Event.Application/EventRecord/EventRecordService.cs index 85b0071..8ff2ec9 100644 --- a/YD_Event.Application/EventRecord/EventRecordService.cs +++ b/YD_Event.Application/EventRecord/EventRecordService.cs @@ -1,6 +1,7 @@ using YD_Event.Application.EventRecord.Dtos; using YD_Event.Core.Entities; using YD_Event.Core.Enum; +using AppUserEntity = YD_Event.Core.Entities.AppUser; namespace YD_Event.Application.EventRecord; @@ -13,14 +14,20 @@ public class EventRecordService : IDynamicApiController, ITransient private readonly ISqlSugarRepository _registrationRep; private readonly ISqlSugarRepository _eventRep; private readonly ISqlSugarRepository _certificateRep; + private readonly ISqlSugarRepository _appUserRep; + private readonly ISqlSugarRepository _merchantRep; public EventRecordService(ISqlSugarRepository registrationRep, ISqlSugarRepository eventRep, - ISqlSugarRepository certificateRep) + ISqlSugarRepository certificateRep, + ISqlSugarRepository appUserRep, + ISqlSugarRepository merchantRep) { _registrationRep = registrationRep; _eventRep = eventRep; _certificateRep = certificateRep; + _appUserRep = appUserRep; + _merchantRep = merchantRep; } /// @@ -29,17 +36,20 @@ public class EventRecordService : IDynamicApiController, ITransient [HttpGet("page")] public async Task> Page([FromQuery] EventRecordPageInput input) { - if (!input.UserId.HasValue) return new PageResult(); - // Join EventRegistration and EventInfo var query = _registrationRep.AsQueryable() .LeftJoin((r, e) => r.EventId == e.Id) - .Where((r, e) => r.CreatedUserId == input.UserId) - .WhereIF(!string.IsNullOrWhiteSpace(input.EventName), (r, e) => e.EventName.Contains(input.EventName)) - .WhereIF(input.StartTime.HasValue, (r, e) => e.MatchStartTime >= input.StartTime) - .WhereIF(input.EndTime.HasValue, (r, e) => e.MatchStartTime <= input.EndTime) - .OrderByDescending((r, e) => r.CreatedTime) - .Select((r, e) => new EventRecordOutput + .LeftJoin((r, e, u) => r.CreatedUserId == u.UserId) + .LeftJoin((r, e, u, m) => r.CreatedUserId == m.CreatedUserId) + .WhereIF(!string.IsNullOrWhiteSpace(input.EventName), (r, e, u, m) => e.EventName.Contains(input.EventName)) + .WhereIF(input.StartTime.HasValue, (r, e, u, m) => e.MatchStartTime >= input.StartTime) + .WhereIF(input.EndTime.HasValue, (r, e, u, m) => e.MatchStartTime <= input.EndTime) + .WhereIF(input.RegistrationStatus.HasValue, (r, e, u, m) => r.RegistrationStatus == input.RegistrationStatus) + // Filter by User ID (AppUser or Merchant) + .WhereIF(input.AppUserId.HasValue, (r, e, u, m) => u.Id == input.AppUserId) + .WhereIF(input.MerchantId.HasValue, (r, e, u, m) => m.Id == input.MerchantId) + .OrderByDescending((r, e, u, m) => r.CreatedTime) + .Select((r, e, u, m) => new EventRecordOutput { Id = r.Id, EventName = e.EventName, @@ -47,7 +57,10 @@ public class EventRecordService : IDynamicApiController, ITransient StartTime = e.MatchStartTime, EndTime = e.MatchEndTime, RegistrationStatus = r.RegistrationStatus, - EventId = e.Id + EventId = e.Id, + ContactName = r.ContactName, + ContactPhone = r.ContactPhone, + TeamName = r.TeamName }); return await query.ToPagedListAsync(input); diff --git a/YD_Event.Application/Merchant/MerchantService.cs b/YD_Event.Application/Merchant/MerchantService.cs index 695e14f..6cbf398 100644 --- a/YD_Event.Application/Merchant/MerchantService.cs +++ b/YD_Event.Application/Merchant/MerchantService.cs @@ -8,7 +8,6 @@ namespace YD_Event.Application.Merchant; /// /// 商户管理 /// -[ApiDescriptionSettings("用户管理", Name = "Merchant", Order = 101)] public class MerchantService : BaseService, ITransient { private readonly ISqlSugarRepository _repository; diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 6ad7110..fd67ab4 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -1195,6 +1195,26 @@ 类型 + + + 普通用户ID + + + + + 商户ID + + + + + 赛事名称 + + + + + 报名状态 + + 参赛记录管理 diff --git a/YD_Event.Core/Entities/Merchant.cs b/YD_Event.Core/Entities/Merchant.cs index 19cfe92..f5d7e81 100644 --- a/YD_Event.Core/Entities/Merchant.cs +++ b/YD_Event.Core/Entities/Merchant.cs @@ -53,7 +53,7 @@ public class Merchant : Entity, ISoftDelete, ICreatedUserId, ICreatedTime, /// /// 审核状态 /// - public AuditStatus AuditStatus { get; set; } + public AuditStatus? AuditStatus { get; set; } /// /// 审核备注