示例#1
0
        /// <summary>
        /// 根据类别查询店铺商品
        /// </summary>
        /// <param name="criteria">搜索条件</param>
        /// <returns></returns>
        public SearchResultModel GetVendorProductByCategoryCode(int sellerSysNo, int categoryCode)
        {
            List <FrontProductCategoryInfo> category = ProductFacade.GetFrontProductCategory(sellerSysNo);
            int strCurrentCategorySysNo;

            if (category.Exists(x => x.SysNo == categoryCode))
            {
                strCurrentCategorySysNo = categoryCode;
            }
            else
            {
                var defaultCate = category.First(p => p.IsLeaf == CommonYesOrNo.Yes);
                if (defaultCate != null)
                {
                    strCurrentCategorySysNo = defaultCate.SysNo;
                }
                else
                {
                    strCurrentCategorySysNo = -1;
                }
            }
            ProductSearchCondition condition = new ProductSearchCondition();

            condition.NValueList = new List <string>();
            //前台分类
            condition.NValueList.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + strCurrentCategorySysNo).ToString());
            condition.Filters = new List <FilterBase>();
            //商家编号
            condition.Filters.Add(new FieldFilter("p_sellersysno", sellerSysNo.ToString()));

            var searchResult = ProductSearchFacade.GetProductSearchResultBySolr(condition);

            SearchResultModel model = new SearchResultModel();

            model.ProductListItems = TransformResultItemList(searchResult.ProductDataList);
            model.PageInfo         = MapPageInfo(searchResult.ProductDataList);
            model.Filters          = MapSearchFilter(searchResult.Navigation);

            return(model);
        }