diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs index 39b437c..c142202 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs @@ -123,15 +123,18 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices foreach (var item in dto.GoodsAttributeValueList) { var updateselect = dellist.FirstOrDefault(x => x.Id == item.Id); - if (updateselect.AttributeValue!=item.AttributeValue|| updateselect.Sort!=item.Sort) + if (updateselect!=null) { - //更新 - BPA_GoodsAttributeValue GoodsAttributeValue = new(); - GoodsAttributeValue.Id = item.Id; - GoodsAttributeValue.AttributeValue =item.AttributeValue; - GoodsAttributeValue.GoodsAttributeId = dto.Id; - GoodsAttributeValue.Sort = item.Sort; - res = await _db.Updateable(GoodsAttributeValue).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + if (updateselect.AttributeValue != item.AttributeValue || updateselect.Sort != item.Sort) + { + //更新 + BPA_GoodsAttributeValue GoodsAttributeValue = new(); + GoodsAttributeValue.Id = item.Id; + GoodsAttributeValue.AttributeValue = item.AttributeValue; + GoodsAttributeValue.GoodsAttributeId = dto.Id; + GoodsAttributeValue.Sort = item.Sort; + res = await _db.Updateable(GoodsAttributeValue).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } } //查询id是否存在 if (string.IsNullOrWhiteSpace(item.GoodsAttributeId))