修改项目部位bug
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-25 16:41:42 +08:00
parent 44bcdf7973
commit 9a958276db
2 changed files with 7 additions and 4 deletions
@@ -1346,12 +1346,15 @@ namespace IRaCIS.Core.Application
public async Task<IResponseOutput> AddOrUpdateTrialBodyPart(AddOrUpdateTrialBodyPartCommand incommand)
{
var codeList = await _repository.Where<TrialBodyPart>(t => t.TrialId == incommand.TrialId).Select(t => t.Code).ToListAsync();
var codeList = await _repository.Where<TrialBodyPart>(t => t.TrialId == incommand.TrialId)
.WhereIf(incommand.Id!=null,t=>t.Id!=incommand.Id)
.Select(t => t.Code).ToListAsync();
var newString = incommand.Code;
// 检查字符串是否在集合中存在,如果存在,则在后面加上一个数字
int count = 1;
while (codeList.Contains(newString))
{
newString = $"{newString}{count}";