修复部分警告

This commit is contained in:
2022-05-05 14:52:58 +08:00
parent 06a760eeff
commit a678e0f8e1
12 changed files with 40 additions and 32 deletions
@@ -324,7 +324,7 @@ namespace IRaCIS.Core.Infra.EFCore
{
var query = ignoreQueryFilter ? _dbSet.AsNoTracking().IgnoreQueryFilters() : _dbSet.AsNoTracking();
var waitDelete = await query.Where(t=>t.Id== id).FirstOrDefaultAsync();
var waitDelete = await query.Where(t => t.Id == id).FirstOrDefaultAsync();
if (waitDelete == null)
{
@@ -572,11 +572,11 @@ namespace IRaCIS.Core.Infra.EFCore
{
foreach (var item in dto.Items)
{
item.Json = await GetInspectionEnumValue(item.Identification,item.Json);
item.Json = await GetInspectionEnumValue(item.Identification, item.Json);
item.Json = await SetEnum(dto.TrialId, item.Identification, item.Json);
}
return dto.Items.Select(x=>x.Json).ToList();
return dto.Items.Select(x => x.Json).ToList();
}
@@ -608,7 +608,7 @@ namespace IRaCIS.Core.Infra.EFCore
continue;
}
string Table = item.ForeignKeyTable;
string ForeignKeyValue = item.ForeignKeyValue;
string ForeignKeyValue = item.ForeignKeyValue;
string ForeignKeyText = item.ForeignKeyText;
string value = JsonDataValue[item.Key].ToString();
string para = string.Empty;
@@ -631,7 +631,7 @@ namespace IRaCIS.Core.Infra.EFCore
new SqlParameter("@para",para)
};
JsonDataValue[item.Key] = string.Join(",", _dbContext.Database.SqlQuery<ForeignKey>(sql, paravalue).Select(x => x.Text).ToList());
}
}
return JsonConvert.SerializeObject(JsonDataValue);
}
@@ -647,7 +647,7 @@ namespace IRaCIS.Core.Infra.EFCore
public async Task<string> SetEnum(Guid trilaid, string identification, string json)
{
var list = await (from u in _dbContext.FrontAuditConfig.Where(x => x.Identification == identification)
join p in _dbContext.FrontAuditConfig.Where(x => x.Code != "AuditState" && x.EnumType=="Date") on u.Id equals p.ParentId
join p in _dbContext.FrontAuditConfig.Where(x => x.Code != "AuditState" && x.EnumType == "Date") on u.Id equals p.ParentId
select new
{
Key = p.Code,
@@ -775,11 +775,12 @@ namespace IRaCIS.Core.Infra.EFCore
private async Task AddInspectionAsync(TEntity entity, bool isSaveAudit = false)
{
bool needsave = true;
DataInspection inspectionData = new DataInspection() {
DataInspection inspectionData = new DataInspection()
{
Identification = $"{GetRequestUrl()}/{ typeof(TEntity).ToString().Substring(typeof(TEntity).ToString().LastIndexOf('.') + 1)}/Add",
};
MapData(entity, inspectionData);
var createtime = DateTime.Now;
@@ -894,7 +895,7 @@ namespace IRaCIS.Core.Infra.EFCore
{
await AddInspectionRecordAsync(inspectionData, entity);
}
}
@@ -1088,7 +1089,7 @@ namespace IRaCIS.Core.Infra.EFCore
}
}
/// <summary>
@@ -1271,7 +1272,7 @@ namespace IRaCIS.Core.Infra.EFCore
}
#endregion
}
#endregion
@@ -1331,9 +1332,15 @@ namespace IRaCIS.Core.Infra.EFCore
{
query = query.IgnoreQueryFilters();
}
if (exp == null)
return await query.FirstOrDefaultAsync().ConfigureAwait(false);
return await query.FirstOrDefaultAsync(exp).ConfigureAwait(false);
if (exp != null)
{
query = query.Where(exp);
}
return await query.FirstOrDefaultAsync().ConfigureAwait(false);
}
#endregion