Commit cc1f915d authored by 黄奎's avatar 黄奎

日志报错修改

parent 82102543
......@@ -7267,9 +7267,9 @@ namespace Mall.Module.Product
var supmodel = demodel.SpecificationList.Where(x => x.Id == item.Id).FirstOrDefault();
Dictionary<string, object> keyValues1 = new Dictionary<string, object>()
{
{ nameof(RB_Goods_Specification.EnabledImage),supmodel.EnabledImage},
{ nameof(RB_Goods_Specification.Name),supmodel.Name},
{ nameof(RB_Goods_Specification.Sort),supmodel.Sort}
{ nameof(RB_Goods_Specification.EnabledImage),supmodel?.EnabledImage??1},
{ nameof(RB_Goods_Specification.Name),supmodel?.Name??""},
{ nameof(RB_Goods_Specification.Sort),supmodel?.Sort??0}
};
List<WhereHelper> wheres1 = new List<WhereHelper>()
{
......@@ -7284,43 +7284,49 @@ namespace Mall.Module.Product
if (flag1)
{
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);
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,
GoodsId = demodel.Id,
Id = 0,
Image = qitem.Image,
MallBaseId = demodel.MallBaseId,
Name = qitem.Name,
Sort = qitem.Sort,
Status = 0,
TenantId = demodel.TenantId,
SpecificationId = item.Id
});
goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue()
{
CreateDate = demodel.CreateDate,
GoodsId = demodel.Id,
Id = 0,
Image = qitem.Image,
MallBaseId = demodel.MallBaseId,
Name = qitem.Name,
Sort = qitem.Sort,
Status = 0,
TenantId = demodel.TenantId,
SpecificationId = item.Id
});
}
}
}
else
{
foreach (var qitem in sv2list)
{
var supModel1 = supmodel.SpecificationValueList.Where(x => x.Id == qitem.Id).FirstOrDefault();
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.Sort),supModel1.Sort}
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Specification.Id),
FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
var supModel1 = supmodel?.SpecificationValueList?.Where(x => x.Id == qitem.Id)?.FirstOrDefault();
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.Sort),supModel1?.Sort??0}
};
List<WhereHelper> wheres2 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods_Specification.Id),
FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
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