统一报名查询口径

This commit is contained in:
马梓彭 2026-06-25 20:51:40 +08:00
parent adf94c6ad8
commit 05cdd4a407
3 changed files with 9 additions and 2 deletions

View File

@ -265,7 +265,7 @@ public class EventClientController : IDynamicApiController
{
var userId = GetCurrentUserId();
isRegistered = await _registrationRepository.IsAnyAsync(r =>
r.EventId == id && r.CreatedUserId == userId &&
r.EventId == id && r.CreatedUserId == userId && !r.DeleteMark &&
((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))));
}
catch

View File

@ -66,6 +66,8 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
public async Task<PageResult<RegistrationListOutput>> Page(RegistrationQueryInput input)
{
var query = _repository.AsQueryable()
// 排除软删除的报名记录
.Where(x => !x.DeleteMark)
// 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1)
.Where(x => (x.PaymentMethod == 2 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && (x.PaymentStatus == 0 || x.PaymentStatus == 1)))
.WhereIF(input.EventId.HasValue, x => x.EventId == input.EventId)
@ -501,6 +503,8 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
public async Task<byte[]> Export(RegistrationQueryInput input)
{
var registrations = await _repository.AsQueryable()
// 排除软删除的报名记录
.Where(x => !x.DeleteMark)
// 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1)
.Where(x => (x.PaymentMethod == 2 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && (x.PaymentStatus == 0 || x.PaymentStatus == 1)))
.WhereIF(input.EventId.HasValue, x => x.EventId == input.EventId)
@ -689,6 +693,7 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
var athletes = await _personRepository.AsQueryable()
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == eventId
&& !r.DeleteMark // 排除软删除的报名记录
// 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1)
&& ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))
&& !p.DeleteMark // 排除已删除的人员

View File

@ -152,7 +152,9 @@ public class EventService : BaseService<EventInfo>, ITransient
// 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别)
// 排除已取消(PaymentStatus = 4)和软删除的报名记录
var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark && x.PaymentStatus != 4);
var hasRegistration = await _registrationRepository.IsAnyAsync(r =>
r.EventId == id && !r.DeleteMark &&
((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))));
output.CanEditProject = !hasRegistration;
// 1. 获取参与单位