diff --git a/COMCMS.Core/Mall/商品.Biz.cs b/COMCMS.Core/Mall/商品.Biz.cs index edb7fcb..db6fb95 100644 --- a/COMCMS.Core/Mall/商品.Biz.cs +++ b/COMCMS.Core/Mall/商品.Biz.cs @@ -198,6 +198,34 @@ namespace COMCMS.Core #endregion #region 业务操作 + /// + /// 获取前几条数据 + /// + /// 栏目id + /// 条数 + /// + public static IList FindTopList(int kid, int records, bool isShowSub = false) + { + if (!isShowSub) + return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records); + else + { + Expression ex = _.IsHide == 0; + List kids = new List(); + kids.Add(kid); + IList subkinds = Category.FindByParentID(kid); + if (subkinds != null && subkinds.Count > 0) + { + foreach (var item in subkinds) + { + kids.Add(item.Id); + } + } + ex &= _.KId.In(kids); + + return FindAll(ex, _.Id.Desc(), null, 0, records); + } + } #endregion } } \ No newline at end of file