后端增加默认排序

Test_IRC_Net8
hang 2026-06-02 17:23:27 +08:00
parent 432bf1ae12
commit 9a0859f915
1 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,9 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<IResponseOutput<PageOutput<IdentityUserJoinedTrialView>>> GetUserJoinedTrialList(IdentityUserJoinedTrialQuery inQuery)
{
var defalutSortArray = new string[] { nameof(IdentityUserJoinedTrialView.TrialCreateTime) + " desc" };
var list = await _trialIdentityUserRepository.Where(t => t.IdentityUserId == inQuery.IdentityUserId && t.Trial.IsDeleted==false, false, true)
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialCode), o => o.Trial.TrialCode.Contains(inQuery.TrialCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.Trial.ResearchProgramNo.Contains(inQuery.ResearchProgramNo))
@ -62,7 +65,7 @@ namespace IRaCIS.Core.Application.Service
UpdateTime = t.UpdateTime,
}).ToList(),
}).ToPagedListAsync(inQuery);
}).ToPagedListAsync(inQuery, defalutSortArray);
var info = await _identityUserRepository.Where(t => t.Id == inQuery.IdentityUserId).Select(t =>
new { t.CreateTime, t.UserCeateSource, t.Trial.ResearchProgramNo, t.Trial.ExperimentName, t.Trial.TrialCode }).FirstOrDefaultAsync();