diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs index d587611..a89237a 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs @@ -93,13 +93,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services { try { - var old = await _db.Queryable().FirstAsync(t => t.Name == dto.Name); - if (old != null) - throw Oops.Oh($"已存在{dto.Name},添加失败!"); var res = 0; if (string.IsNullOrWhiteSpace(dto.Id)) { _db.Ado.BeginTran(); + var old = await _db.Queryable().FirstAsync(t => t.Name == dto.Name); + if (old != null) + throw Oops.Oh($"已存在{dto.Name},添加失败!"); var newType = new BPA_GoodsType { Pid = dto.Pid ?? "0",