From c66589574c4ad6bae2aabbc6b7360cca08057fa2 Mon Sep 17 00:00:00 2001 From: Hogen Date: Tue, 24 Sep 2024 19:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COMCMS.Core/Mall/商品.Biz.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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