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