From 825467d7ddf62c1d2f9b050e5a1291986d44068e Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Sat, 25 May 2024 15:50:48 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E5=A2=9E=E5=8A=A0=E5=88=A4=E7=A9=BA?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/GoodsAttributeService.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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))