瀏覽代碼

opt:增加判空操作

ingredientmanage
zhaoy 7 月之前
父節點
當前提交
825467d7dd
共有 1 個檔案被更改,包括 11 行新增8 行删除
  1. +11
    -8
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs

+ 11
- 8
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))


Loading…
取消
儲存