优化 写入选科时候无数据导致的异常

This commit is contained in:
小肥羊 2025-12-09 11:05:34 +08:00
parent 1920c6ba9c
commit 182e891584
1 changed files with 8 additions and 0 deletions

View File

@ -498,7 +498,14 @@ namespace Learn.Archives.API.Controllers
}, ex => { throw ex; }); }, ex => { throw ex; });
} }
//写入选科方向 //写入选科方向
userCenterUpdate = userCenterUpdate.Where(s =>
new object[] { s.Phone,
s.GLSubject,
s.GSubject1,
s.GSubject2,}
.Any(x => !(x == default || x == null))).ToList();
if (userCenterUpdate.Count > 0) if (userCenterUpdate.Count > 0)
{
await userService.AsUpdateable(userCenterUpdate) await userService.AsUpdateable(userCenterUpdate)
.UpdateColumns(s => new .UpdateColumns(s => new
{ {
@ -511,6 +518,7 @@ namespace Learn.Archives.API.Controllers
.IgnoreColumns(ignoreAllNullColumns: true, ignoreAllDefaultValue: true) .IgnoreColumns(ignoreAllNullColumns: true, ignoreAllDefaultValue: true)
.WhereColumns(it => new { it.Id }) .WhereColumns(it => new { it.Id })
.ExecuteCommandAsync(); .ExecuteCommandAsync();
}
return Ok(); return Ok();
} }