Commit cc1f915d authored by 黄奎's avatar 黄奎

日志报错修改

parent 82102543
...@@ -7267,9 +7267,9 @@ namespace Mall.Module.Product ...@@ -7267,9 +7267,9 @@ namespace Mall.Module.Product
var supmodel = demodel.SpecificationList.Where(x => x.Id == item.Id).FirstOrDefault(); var supmodel = demodel.SpecificationList.Where(x => x.Id == item.Id).FirstOrDefault();
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() Dictionary<string, object> keyValues1 = new Dictionary<string, object>()
{ {
{ nameof(RB_Goods_Specification.EnabledImage),supmodel.EnabledImage}, { nameof(RB_Goods_Specification.EnabledImage),supmodel?.EnabledImage??1},
{ nameof(RB_Goods_Specification.Name),supmodel.Name}, { nameof(RB_Goods_Specification.Name),supmodel?.Name??""},
{ nameof(RB_Goods_Specification.Sort),supmodel.Sort} { nameof(RB_Goods_Specification.Sort),supmodel?.Sort??0}
}; };
List<WhereHelper> wheres1 = new List<WhereHelper>() List<WhereHelper> wheres1 = new List<WhereHelper>()
{ {
...@@ -7284,43 +7284,49 @@ namespace Mall.Module.Product ...@@ -7284,43 +7284,49 @@ namespace Mall.Module.Product
if (flag1) if (flag1)
{ {
var sv2list = svlist.Where(x => x.SpecificationId == item.Id).ToList(); var sv2list = svlist.Where(x => x.SpecificationId == item.Id).ToList();
if (sv2list.Count() != supmodel.SpecificationValueList.Count() || sv2list.Count() != supmodel.SpecificationValueList.Where(x => x.Id > 0).Count()) if (sv2list.Count() != supmodel?.SpecificationValueList?.Count() || sv2list.Count() != supmodel?.SpecificationValueList?.Where(x => x.Id > 0)?.Count())
{ {
goods_SpecificationValueRepository.DeleteBatch(sv2list); goods_SpecificationValueRepository.DeleteBatch(sv2list);
foreach (var qitem in supmodel.SpecificationValueList) if (supmodel != null && supmodel.SpecificationValueList != null && supmodel.SpecificationValueList.Count > 0)
{ {
goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue() foreach (var qitem in supmodel?.SpecificationValueList)
{ {
CreateDate = demodel.CreateDate, goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue()
GoodsId = demodel.Id, {
Id = 0, CreateDate = demodel.CreateDate,
Image = qitem.Image, GoodsId = demodel.Id,
MallBaseId = demodel.MallBaseId, Id = 0,
Name = qitem.Name, Image = qitem.Image,
Sort = qitem.Sort, MallBaseId = demodel.MallBaseId,
Status = 0, Name = qitem.Name,
TenantId = demodel.TenantId, Sort = qitem.Sort,
SpecificationId = item.Id Status = 0,
}); TenantId = demodel.TenantId,
SpecificationId = item.Id
});
}
} }
} }
else else
{ {
foreach (var qitem in sv2list) foreach (var qitem in sv2list)
{ {
var supModel1 = supmodel.SpecificationValueList.Where(x => x.Id == qitem.Id).FirstOrDefault(); var supModel1 = supmodel?.SpecificationValueList?.Where(x => x.Id == qitem.Id)?.FirstOrDefault();
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() { Dictionary<string, object> keyValues2 = new Dictionary<string, object>()
{ nameof(RB_Goods_SpecificationValue.Image),supModel1.Image}, {
{ nameof(RB_Goods_SpecificationValue.Name),supModel1.Name}, { nameof(RB_Goods_SpecificationValue.Image),supModel1?.Image??""},
{ nameof(RB_Goods_SpecificationValue.Sort),supModel1.Sort} { nameof(RB_Goods_SpecificationValue.Name),supModel1?.Name??""},
}; { nameof(RB_Goods_SpecificationValue.Sort),supModel1?.Sort??0}
List<WhereHelper> wheres2 = new List<WhereHelper>() { };
new WhereHelper(){ List<WhereHelper> wheres2 = new List<WhereHelper>()
FiledName=nameof(RB_Goods_Specification.Id), {
FiledValue=qitem.Id, new WhereHelper()
OperatorEnum=OperatorEnum.Equal {
} FiledName=nameof(RB_Goods_Specification.Id),
}; FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_SpecificationValueRepository.Update(keyValues2, wheres2); goods_SpecificationValueRepository.Update(keyValues2, wheres2);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment