用户管理查询条件修改
This commit is contained in:
parent
6dde446f5f
commit
1e807d34ee
@ -8,7 +8,6 @@ namespace YD_Event.Application.AppUser;
|
||||
/// <summary>
|
||||
/// 普通用户服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("用户管理", Name = "AppUser", Order = 100)]
|
||||
public class AppUserService : BaseService<AppUserEntity>, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<AppUserEntity> _appUserRep;
|
||||
|
||||
@ -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
|
||||
/// <summary>
|
||||
/// 普通用户ID
|
||||
/// </summary>
|
||||
public long? AppUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商户ID
|
||||
/// </summary>
|
||||
public long? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 赛事名称
|
||||
/// </summary>
|
||||
public string? EventName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报名状态
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -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<EventRegistration> _registrationRep;
|
||||
private readonly ISqlSugarRepository<EventInfo> _eventRep;
|
||||
private readonly ISqlSugarRepository<EventCertificate> _certificateRep;
|
||||
private readonly ISqlSugarRepository<AppUserEntity> _appUserRep;
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Merchant> _merchantRep;
|
||||
|
||||
public EventRecordService(ISqlSugarRepository<EventRegistration> registrationRep,
|
||||
ISqlSugarRepository<EventInfo> eventRep,
|
||||
ISqlSugarRepository<EventCertificate> certificateRep)
|
||||
ISqlSugarRepository<EventCertificate> certificateRep,
|
||||
ISqlSugarRepository<AppUserEntity> appUserRep,
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.Merchant> merchantRep)
|
||||
{
|
||||
_registrationRep = registrationRep;
|
||||
_eventRep = eventRep;
|
||||
_certificateRep = certificateRep;
|
||||
_appUserRep = appUserRep;
|
||||
_merchantRep = merchantRep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,17 +36,20 @@ public class EventRecordService : IDynamicApiController, ITransient
|
||||
[HttpGet("page")]
|
||||
public async Task<PageResult<EventRecordOutput>> Page([FromQuery] EventRecordPageInput input)
|
||||
{
|
||||
if (!input.UserId.HasValue) return new PageResult<EventRecordOutput>();
|
||||
|
||||
// Join EventRegistration and EventInfo
|
||||
var query = _registrationRep.AsQueryable()
|
||||
.LeftJoin<EventInfo>((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<AppUserEntity>((r, e, u) => r.CreatedUserId == u.UserId)
|
||||
.LeftJoin<YD_Event.Core.Entities.Merchant>((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);
|
||||
|
||||
@ -8,7 +8,6 @@ namespace YD_Event.Application.Merchant;
|
||||
/// <summary>
|
||||
/// 商户管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("用户管理", Name = "Merchant", Order = 101)]
|
||||
public class MerchantService : BaseService<YD_Event.Core.Entities.Merchant>, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Merchant> _repository;
|
||||
|
||||
@ -1195,6 +1195,26 @@
|
||||
类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.EventRecord.Dtos.EventRecordPageInput.AppUserId">
|
||||
<summary>
|
||||
普通用户ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.EventRecord.Dtos.EventRecordPageInput.MerchantId">
|
||||
<summary>
|
||||
商户ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.EventRecord.Dtos.EventRecordPageInput.EventName">
|
||||
<summary>
|
||||
赛事名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.EventRecord.Dtos.EventRecordPageInput.RegistrationStatus">
|
||||
<summary>
|
||||
报名状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.EventRecord.EventRecordService">
|
||||
<summary>
|
||||
参赛记录管理
|
||||
|
||||
@ -53,7 +53,7 @@ public class Merchant : Entity<long>, ISoftDelete, ICreatedUserId, ICreatedTime,
|
||||
/// <summary>
|
||||
/// 审核状态
|
||||
/// </summary>
|
||||
public AuditStatus AuditStatus { get; set; }
|
||||
public AuditStatus? AuditStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审核备注
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user