|
|
@@ -6,6 +6,7 @@ using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; |
|
|
|
using StackExchange.Profiling.Internal; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices |
|
|
|
{ |
|
|
|
public class GoodsAttributeService: IGoodsAttributeService, ITransient |
|
|
@@ -123,7 +124,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices |
|
|
|
foreach (var item in dto.GoodsAttributeValueList) |
|
|
|
{ |
|
|
|
var updateselect = dellist.FirstOrDefault(x => x.Id == item.Id); |
|
|
|
if (updateselect!=null) |
|
|
|
if (updateselect != null) |
|
|
|
{ |
|
|
|
if (updateselect.AttributeValue != item.AttributeValue || updateselect.Sort != item.Sort) |
|
|
|
{ |
|
|
@@ -136,8 +137,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices |
|
|
|
res = await _db.Updateable(GoodsAttributeValue).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
//查询id是否存在 |
|
|
|
if (string.IsNullOrWhiteSpace(item.GoodsAttributeId)) |
|
|
|
else |
|
|
|
{ |
|
|
|
//新增 |
|
|
|
BPA_GoodsAttributeValue GoodsAttributeValue = new(); |
|
|
@@ -196,7 +196,16 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices |
|
|
|
{ |
|
|
|
// 查询数据库中是否存在未删除的商品 |
|
|
|
var resEntitites = _db.Queryable<BPA_GoodsAttribute>().In(Ids).ToList(); |
|
|
|
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
var goodsTechnologyAction = _db.Queryable<BPA_GoodsTechnologyAction>() |
|
|
|
.InnerJoin<BPA_GoodsAttributeValue>((o, cus) => o.GoodsAttributeId.Contains(cus.Id)) |
|
|
|
.InnerJoin<BPA_GoodsAttribute>((o, cus, oritem) =>cus.GoodsAttributeId == oritem.Id && Ids.Contains(oritem.Id)) |
|
|
|
.ToList(); // 将查询结果转换为列表 |
|
|
|
if (goodsTechnologyAction.Count()>0) |
|
|
|
{ |
|
|
|
throw Oops.Oh("该属性已经使用无法删除!"); |
|
|
|
} |
|
|
|
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync(); |
|
|
|
if (res > 0) |
|
|
|
{ |
|
|
|
var resEntititesattr = _db.Queryable<BPA_GoodsAttributeValue>().In("GoodsAttributeId", Ids).ToList(); |
|
|
|