fix name重复校验

This commit is contained in:
2025-02-25 17:31:22 +08:00
parent 8c915f73ce
commit ca2f50511f

View File

@@ -37,6 +37,13 @@ public class WorkGridService : IWorkGridService
true.ThrowIfTrue($"工号:{request.LeaderUserCode}不存在");
}
if (await _dbContext.Queryable<WorkGridEntity>().Where(x => x.Name == request.Name)
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
.AnyAsync())
{
true.ThrowIfTrue($"网格区域名称[{request.Name}]重复");
}
exists.ThrowIfTrue($"{request.LeaderUserCode}已存在管理的网格");
if (!request.Id.HasValue)