mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-23 00:37:21 +08:00
【修复】修复后台商品按分类查询,未迭代计算下级分类的问题,同时接口端增加多级判断。
This commit is contained in:
@@ -25,6 +25,7 @@ using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -195,16 +196,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
className = category.name;
|
||||
}
|
||||
|
||||
var childs = await _goodsCategoryServices.QueryListByClauseAsync(p => p.parentId == catId, p => p.sort, OrderByType.Asc, true, true);
|
||||
if (childs.Any())
|
||||
{
|
||||
var ids = childs.Select(p => p.id).ToList();
|
||||
where = where.And(p => ids.Contains(p.goodsCategoryId) || p.goodsCategoryId == catId);
|
||||
}
|
||||
else
|
||||
{
|
||||
where = where.And(p => p.goodsCategoryId == catId);
|
||||
}
|
||||
var categories = await _goodsCategoryServices.QueryAsync(true, true);
|
||||
var ids = GoodsHelper.GetChildIds(categories, catId);
|
||||
where = where.And(p => ids.Contains(p.goodsCategoryId));
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(obj.brandId))
|
||||
|
||||
Reference in New Issue
Block a user