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,10 +7284,12 @@ namespace Mall.Module.Product ...@@ -7284,10 +7284,12 @@ 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)
{
foreach (var qitem in supmodel?.SpecificationValueList)
{ {
goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue() goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue()
{ {
...@@ -7304,18 +7306,22 @@ namespace Mall.Module.Product ...@@ -7304,18 +7306,22 @@ namespace Mall.Module.Product
}); });
} }
} }
}
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>() { List<WhereHelper> wheres2 = new List<WhereHelper>()
new WhereHelper(){ {
new WhereHelper()
{
FiledName=nameof(RB_Goods_Specification.Id), FiledName=nameof(RB_Goods_Specification.Id),
FiledValue=qitem.Id, FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
......
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