示例#1
0
        /// <summary>
        /// 获得搜索条数
        /// </summary>
        /// <param name="search">搜索关键字</param>
        /// <returns>条数</returns>
        public int GetViewBySearchCount(string search)
        {
            Commodity_Stageprice_View c = new Commodity_Stageprice_View();

            c.Name      = search;
            c.Content   = search;
            c.Introduce = search;
            return(Commodity_Stageprice_ViewOper.Instance.SelectBySearchCount(c));
        }
示例#2
0
        /// <summary>
        /// 分页获得搜索数据
        /// </summary>
        /// <param name="search">搜索关键字</param>
        /// <returns>数据</returns>
        public List <Commodity_Stageprice_View> GetViewBySearch(string search, int?PageNo)
        {
            Commodity_Stageprice_View c = new Commodity_Stageprice_View();

            c.Name      = search;
            c.Content   = search;
            c.Introduce = search;
            return(Commodity_Stageprice_ViewOper.Instance.SelectBySearch(PageNo, c));
        }
示例#3
0
        public List <Commodity_Stageprice_View> GetListCommViewByGrade(GradeRes g)
        {
            var ids = GetGradeIdsByGradeRes(g);
            Commodity_Stageprice_View c = new Commodity_Stageprice_View
            {
                GradeId = 1
            };

            return(Commodity_Stageprice_ViewOper.Instance.SelectByGradeIds(c, null, null, ids));
            //return CommodityspviewOper.Instance.SelectByGradeIds(c, null, null, ids);
        }
示例#4
0
        /// <summary>
        /// 通过关键词筛选数据数量
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>数量</returns>
        public int SelectBySearchCount(Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            query.Where(p => p.IsDelete != true);
            if (model != null)
            {
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name.Contains(model.Name) || p.Content.Contains(model.Content) || p.Introduce.Contains(model.Introduce));
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
示例#5
0
        public CommodityListRes(Commodity_Stageprice_View comm)
        {
            id    = comm.Id;
            image = AdminUrl + comm.Image;//-txy
            name  = comm.Name;

            price = $"价格从{comm.minPrice}元到{comm.maxPrice}元";
            intro = comm.Introduce;
            if (comm.minAmount != null)
            {
                minAmount = (int)comm.minAmount;
            }
            stars = Convert.ToInt32(Math.Floor((decimal)comm.Stars));
        }
示例#6
0
        public int SelectCountForSearchList(Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null, List <int> ids = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            if (model != null)
            {
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name.Contains(model.Name) || p.Content.Contains(model.Content) || p.Introduce.Contains(model.Introduce));
                }
                if (!model.Sales.IsNullOrEmpty())
                {
                    query.Where(p => p.Sales >= model.Sales);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
示例#7
0
        /// <summary>
        /// 根据商品id集合获取商品信息视图
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="ids"></param>
        /// <param name="sales"></param>
        /// <param name="orderStr"></param>
        /// <returns></returns>
        public List <Commodity_Stageprice_View> GetCommsByIds(int index, int size, List <int> ids = null, int?sales = null, string orderStr = null)
        {
            Commodity_Stageprice_View c = new Commodity_Stageprice_View();

            c.Id       = 1;
            c.IsDelete = false;
            if (sales != null)
            {
                c.Sales = 1;
            }
            string key  = "";
            bool   desc = true;

            switch (orderStr)
            {
            case "salesDesc":
                key  = "sales";
                desc = true;
                break;

            case "price":
                key  = "maxPrice";
                desc = false;
                break;

            case "priceDesc":
                key  = "maxPrice";
                desc = true;
                break;

            case "starsDesc":
                key  = "stars";
                desc = true;
                break;

            case "createTimeDesc":
                key  = "createTime";
                desc = true;
                break;
            }

            return(Commodity_Stageprice_ViewOper.Instance.SelectByPageForCommList(key, index * size, size, desc, c, null, null, ids, sales));
        }
示例#8
0
 /// <summary>
 /// 商品信息
 /// </summary>
 /// <param name="commodityView">信息模型</param>
 public CommodityInfo(Commodity_Stageprice_View commodityView)
 {
     //商品Id
     this.Id = commodityView.Id;
     //商品名称
     this.Name = commodityView.Name;
     //商品图片
     this.Image = commodityView.Image;
     //商品销售量
     this.Sales = commodityView.Sales;
     //创建时间
     this.CreateTime = commodityView.CreateTime == null ? "暂无创建时间" : commodityView.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
     //推荐时间
     this.RecommendTime = commodityView.RecommendTime == null ? "暂无推荐时间" : commodityView.RecommendTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
     //是否发布
     this.IsRelease = commodityView.IsRelease == null ? "否" : commodityView.IsRelease == true ? "是" : "否";
     //最小价格
     this.minPrice = commodityView.minPrice == null ? "暂无价格" : commodityView.minPrice.ToString();
 }
示例#9
0
        /// <summary>
        /// 通过关键词筛选数据
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Commodity_Stageprice_View> SelectBySearch(int?PageNo, Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            query.Where(p => p.IsDelete != true);
            if (model != null)
            {
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name.Contains(model.Name) || p.Content.Contains(model.Content) || p.Introduce.Contains(model.Introduce));
                }
            }
            if (PageNo == null)
            {
                return(query.GetQueryList(connection, transaction));
            }
            else
            {
                return(query.GetQueryPageList((PageNo.Value - 1) * 15, 15, connection, transaction));
            }
        }
示例#10
0
        /// <summary>
        /// 根据分页筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Commodity_Stageprice_View> SelectByPage(string Key, int start, int PageSize, bool desc = true, Commodity_Stageprice_View model = null, string SelectFiled = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.Image.IsNullOrEmpty())
                {
                    query.Where(p => p.Image == model.Image);
                }
                if (!model.GradeId.IsNullOrEmpty())
                {
                    query.Where(p => p.GradeId == model.GradeId);
                }
                if (!model.ScenceIds.IsNullOrEmpty())
                {
                    query.Where(p => p.ScenceIds == model.ScenceIds);
                }
                if (!model.FrontView.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontView == model.FrontView);
                }
                if (!model.BackView.IsNullOrEmpty())
                {
                    query.Where(p => p.BackView == model.BackView);
                }
                if (!model.PrintingMethod.IsNullOrEmpty())
                {
                    query.Where(p => p.PrintingMethod == model.PrintingMethod);
                }
                if (!model.Color.IsNullOrEmpty())
                {
                    query.Where(p => p.Color == model.Color);
                }
                if (!model.Content.IsNullOrEmpty())
                {
                    query.Where(p => p.Content == model.Content);
                }
                if (!model.Sales.IsNullOrEmpty())
                {
                    query.Where(p => p.Sales == model.Sales);
                }
                if (!model.CreateTime.IsNullOrEmpty())
                {
                    query.Where(p => p.CreateTime == model.CreateTime);
                }
                if (!model.RecommendTime.IsNullOrEmpty())
                {
                    query.Where(p => p.RecommendTime == model.RecommendTime);
                }
                if (!model.Points.IsNullOrEmpty())
                {
                    query.Where(p => p.Points == model.Points);
                }
                if (!model.IsRelease.IsNullOrEmpty())
                {
                    query.Where(p => p.IsRelease == model.IsRelease);
                }
                if (!model.LastOperTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperTime == model.LastOperTime);
                }
                if (!model.LastOperId.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperId == model.LastOperId);
                }
                if (!model.ClickCount.IsNullOrEmpty())
                {
                    query.Where(p => p.ClickCount == model.ClickCount);
                }
                if (!model.Stars.IsNullOrEmpty())
                {
                    query.Where(p => p.Stars == model.Stars);
                }
                if (!model.StarCount.IsNullOrEmpty())
                {
                    query.Where(p => p.StarCount == model.StarCount);
                }
                if (!model.Introduce.IsNullOrEmpty())
                {
                    query.Where(p => p.Introduce == model.Introduce);
                }
                if (!model.ImageList.IsNullOrEmpty())
                {
                    query.Where(p => p.ImageList == model.ImageList);
                }
                if (!model.PringtingPosition.IsNullOrEmpty())
                {
                    query.Where(p => p.PringtingPosition == model.PringtingPosition);
                }
                if (!model.CommodityInfo.IsNullOrEmpty())
                {
                    query.Where(p => p.CommodityInfo == model.CommodityInfo);
                }
                if (!model.MaterialId.IsNullOrEmpty())
                {
                    query.Where(p => p.MaterialId == model.MaterialId);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.minPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.minPrice == model.minPrice);
                }
                if (!model.maxPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.maxPrice == model.maxPrice);
                }
                if (!model.minAmount.IsNullOrEmpty())
                {
                    query.Where(p => p.minAmount == model.minAmount);
                }
                if (!model.ProductNo.IsNullOrEmpty())
                {
                    query.Where(p => p.ProductNo == model.ProductNo);
                }
            }
            if (SelectFiled != null)
            {
                SelectFiled = SelectFiled.ToLowerInvariant();
                if (SelectFiled.Contains("id,"))
                {
                    query.Select(p => new { p.Id });
                }
                if (SelectFiled.Contains("name,"))
                {
                    query.Select(p => new { p.Name });
                }
                if (SelectFiled.Contains("image,"))
                {
                    query.Select(p => new { p.Image });
                }
                if (SelectFiled.Contains("gradeid,"))
                {
                    query.Select(p => new { p.GradeId });
                }
                if (SelectFiled.Contains("scenceids,"))
                {
                    query.Select(p => new { p.ScenceIds });
                }
                if (SelectFiled.Contains("frontview,"))
                {
                    query.Select(p => new { p.FrontView });
                }
                if (SelectFiled.Contains("backview,"))
                {
                    query.Select(p => new { p.BackView });
                }
                if (SelectFiled.Contains("printingmethod,"))
                {
                    query.Select(p => new { p.PrintingMethod });
                }
                if (SelectFiled.Contains("color,"))
                {
                    query.Select(p => new { p.Color });
                }
                if (SelectFiled.Contains("content,"))
                {
                    query.Select(p => new { p.Content });
                }
                if (SelectFiled.Contains("sales,"))
                {
                    query.Select(p => new { p.Sales });
                }
                if (SelectFiled.Contains("createtime,"))
                {
                    query.Select(p => new { p.CreateTime });
                }
                if (SelectFiled.Contains("recommendtime,"))
                {
                    query.Select(p => new { p.RecommendTime });
                }
                if (SelectFiled.Contains("points,"))
                {
                    query.Select(p => new { p.Points });
                }
                if (SelectFiled.Contains("isrelease,"))
                {
                    query.Select(p => new { p.IsRelease });
                }
                if (SelectFiled.Contains("lastopertime,"))
                {
                    query.Select(p => new { p.LastOperTime });
                }
                if (SelectFiled.Contains("lastoperid,"))
                {
                    query.Select(p => new { p.LastOperId });
                }
                if (SelectFiled.Contains("clickcount,"))
                {
                    query.Select(p => new { p.ClickCount });
                }
                if (SelectFiled.Contains("stars,"))
                {
                    query.Select(p => new { p.Stars });
                }
                if (SelectFiled.Contains("starcount,"))
                {
                    query.Select(p => new { p.StarCount });
                }
                if (SelectFiled.Contains("introduce,"))
                {
                    query.Select(p => new { p.Introduce });
                }
                if (SelectFiled.Contains("imagelist,"))
                {
                    query.Select(p => new { p.ImageList });
                }
                if (SelectFiled.Contains("pringtingposition,"))
                {
                    query.Select(p => new { p.PringtingPosition });
                }
                if (SelectFiled.Contains("commodityinfo,"))
                {
                    query.Select(p => new { p.CommodityInfo });
                }
                if (SelectFiled.Contains("materialid,"))
                {
                    query.Select(p => new { p.MaterialId });
                }
                if (SelectFiled.Contains("isdelete,"))
                {
                    query.Select(p => new { p.IsDelete });
                }
                if (SelectFiled.Contains("minprice,"))
                {
                    query.Select(p => new { p.minPrice });
                }
                if (SelectFiled.Contains("maxprice,"))
                {
                    query.Select(p => new { p.maxPrice });
                }
                if (SelectFiled.Contains("minamount,"))
                {
                    query.Select(p => new { p.minAmount });
                }
                if (SelectFiled.Contains("productno,"))
                {
                    query.Select(p => new { p.ProductNo });
                }
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, PageSize, connection, transaction));
        }
示例#11
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCount(Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.Image.IsNullOrEmpty())
                {
                    query.Where(p => p.Image == model.Image);
                }
                if (!model.GradeId.IsNullOrEmpty())
                {
                    query.Where(p => p.GradeId == model.GradeId);
                }
                if (!model.ScenceIds.IsNullOrEmpty())
                {
                    query.Where(p => p.ScenceIds == model.ScenceIds);
                }
                if (!model.FrontView.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontView == model.FrontView);
                }
                if (!model.BackView.IsNullOrEmpty())
                {
                    query.Where(p => p.BackView == model.BackView);
                }
                if (!model.PrintingMethod.IsNullOrEmpty())
                {
                    query.Where(p => p.PrintingMethod == model.PrintingMethod);
                }
                if (!model.Color.IsNullOrEmpty())
                {
                    query.Where(p => p.Color == model.Color);
                }
                if (!model.Content.IsNullOrEmpty())
                {
                    query.Where(p => p.Content == model.Content);
                }
                if (!model.Sales.IsNullOrEmpty())
                {
                    query.Where(p => p.Sales == model.Sales);
                }
                if (!model.CreateTime.IsNullOrEmpty())
                {
                    query.Where(p => p.CreateTime == model.CreateTime);
                }
                if (!model.RecommendTime.IsNullOrEmpty())
                {
                    query.Where(p => p.RecommendTime == model.RecommendTime);
                }
                if (!model.Points.IsNullOrEmpty())
                {
                    query.Where(p => p.Points == model.Points);
                }
                if (!model.IsRelease.IsNullOrEmpty())
                {
                    query.Where(p => p.IsRelease == model.IsRelease);
                }
                if (!model.LastOperTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperTime == model.LastOperTime);
                }
                if (!model.LastOperId.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperId == model.LastOperId);
                }
                if (!model.ClickCount.IsNullOrEmpty())
                {
                    query.Where(p => p.ClickCount == model.ClickCount);
                }
                if (!model.Stars.IsNullOrEmpty())
                {
                    query.Where(p => p.Stars == model.Stars);
                }
                if (!model.StarCount.IsNullOrEmpty())
                {
                    query.Where(p => p.StarCount == model.StarCount);
                }
                if (!model.Introduce.IsNullOrEmpty())
                {
                    query.Where(p => p.Introduce == model.Introduce);
                }
                if (!model.ImageList.IsNullOrEmpty())
                {
                    query.Where(p => p.ImageList == model.ImageList);
                }
                if (!model.PringtingPosition.IsNullOrEmpty())
                {
                    query.Where(p => p.PringtingPosition == model.PringtingPosition);
                }
                if (!model.CommodityInfo.IsNullOrEmpty())
                {
                    query.Where(p => p.CommodityInfo == model.CommodityInfo);
                }
                if (!model.MaterialId.IsNullOrEmpty())
                {
                    query.Where(p => p.MaterialId == model.MaterialId);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.minPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.minPrice == model.minPrice);
                }
                if (!model.maxPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.maxPrice == model.maxPrice);
                }
                if (!model.minAmount.IsNullOrEmpty())
                {
                    query.Where(p => p.minAmount == model.minAmount);
                }
                if (!model.ProductNo.IsNullOrEmpty())
                {
                    query.Where(p => p.ProductNo == model.ProductNo);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
示例#12
0
        /// <summary>
        /// 根据关键词筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Commodity_Stageprice_View> SelectByPageForSearchList(string Key, int start, int PageSize, bool desc = true, Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            if (model != null)
            {
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name.Contains(model.Name) || p.Content.Contains(model.Content) || p.Introduce.Contains(model.Introduce));
                }
                if (!model.Sales.IsNullOrEmpty())
                {
                    query.Where(p => p.Sales >= model.Sales);
                }



                if (!model.Image.IsNullOrEmpty())
                {
                    query.Where(p => p.Image == model.Image);
                }
                if (!model.GradeId.IsNullOrEmpty())
                {
                    query.Where(p => p.GradeId == model.GradeId);
                }
                if (!model.FrontView.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontView == model.FrontView);
                }
                if (!model.BackView.IsNullOrEmpty())
                {
                    query.Where(p => p.BackView == model.BackView);
                }
                if (!model.PrintingMethod.IsNullOrEmpty())
                {
                    query.Where(p => p.PrintingMethod == model.PrintingMethod);
                }
                if (!model.Color.IsNullOrEmpty())
                {
                    query.Where(p => p.Color == model.Color);
                }


                if (!model.CreateTime.IsNullOrEmpty())
                {
                    query.Where(p => p.CreateTime == model.CreateTime);
                }
                if (!model.RecommendTime.IsNullOrEmpty())
                {
                    query.Where(p => p.RecommendTime == model.RecommendTime);
                }
                if (!model.Points.IsNullOrEmpty())
                {
                    query.Where(p => p.Points == model.Points);
                }
                if (!model.IsRelease.IsNullOrEmpty())
                {
                    query.Where(p => p.IsRelease == model.IsRelease);
                }
                if (!model.LastOperTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperTime == model.LastOperTime);
                }
                if (!model.LastOperId.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperId == model.LastOperId);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.ClickCount.IsNullOrEmpty())
                {
                    query.Where(p => p.ClickCount == model.ClickCount);
                }
                if (!model.Stars.IsNullOrEmpty())
                {
                    query.Where(p => p.Stars == model.Stars);
                }
                if (!model.StarCount.IsNullOrEmpty())
                {
                    query.Where(p => p.StarCount == model.StarCount);
                }

                if (!model.ImageList.IsNullOrEmpty())
                {
                    query.Where(p => p.ImageList == model.ImageList);
                }
                if (!model.minPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.minPrice == model.minPrice);
                }
                if (!model.maxPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.maxPrice == model.maxPrice);
                }
                if (!model.minAmount.IsNullOrEmpty())
                {
                    query.Where(p => p.minAmount == model.minAmount);
                }
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, (int)PageSize, connection, transaction));
        }
 /// <summary>
 /// 数据条数
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public int SelectCount(Commodity_Stageprice_View model)
 {
     return(Commodity_Stageprice_ViewOper.Instance.SelectCount(model));
 }
示例#14
0
        public CommodityRes GetSearchList(int index, int size, string search, int?sales = null, string orderStr = null)
        {
            CommodityRes r    = new CommodityRes();
            string       key  = "";
            bool         desc = true;

            switch (orderStr)
            {
            case "salesDesc":
                key  = "sales";
                desc = true;
                break;

            case "price":
                key  = "maxPrice";
                desc = false;
                break;

            case "priceDesc":
                key  = "maxPrice";
                desc = true;
                break;

            case "starsDesc":
                key  = "stars";
                desc = true;
                break;

            case "createTimeDesc":
                key  = "createTime";
                desc = true;
                break;
            }

            Commodity_Stageprice_View c = new Commodity_Stageprice_View();

            c.Name      = search;
            c.Introduce = search;
            c.Content   = search;
            c.Sales     = sales;
            c.IsDelete  = false;

            var count = Commodity_Stageprice_ViewOper.Instance.SelectCountForSearchList(c, null, null);

            var listComm = Commodity_Stageprice_ViewOper.Instance.SelectByPageForSearchList(key, index * size, size, desc, c);

            List <CommodityListRes> commList = new List <CommodityListRes>();

            foreach (var item in listComm)
            {
                var res = new CommodityListRes(item);
                commList.Add(res);
            }

            var pages = count / size;

            //总页数
            pages = pages * size == count ? pages : pages + 1;

            r.ListData = commList;
            r.index    = (int)index;
            r.pages    = (int)pages;
            return(r);
        }
示例#15
0
        /// <summary>
        /// 根据条件筛选商品
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public CommodityRes GetCommList(int index, int size, List <int> ids = null, int?sales = null, string orderStr = null)
        {
            CommodityRes r = new CommodityRes();

            if (ids != null)
            {
                Commodity_Stageprice_View c = new Commodity_Stageprice_View();
                c.Id       = 1;
                c.IsDelete = false;
                if (sales != null)
                {
                    c.Sales = 1;
                }

                string key  = "";
                bool   desc = true;
                switch (orderStr)
                {
                case "salesDesc":
                    key  = "sales";
                    desc = true;
                    break;

                case "price":
                    key  = "maxPrice";
                    desc = false;
                    break;

                case "priceDesc":
                    key  = "maxPrice";
                    desc = true;
                    break;

                case "starsDesc":
                    key  = "stars";
                    desc = true;
                    break;

                case "createTimeDesc":
                    key  = "createTime";
                    desc = true;
                    break;
                }

                //CommodityspviewOper.Instance.SelectByPageForCommList(key, 0, 9, desc, c, null, null, ids, sales);

                var count = Commodity_Stageprice_ViewOper.Instance.SelectCountForCommList(c, null, null, ids, sales);

                var listComm = Commodity_Stageprice_ViewOper.Instance.SelectByPageForCommList(key, index * size, size, desc, c, null, null, ids, sales);

                List <CommodityListRes> commList = new List <CommodityListRes>();
                foreach (var item in listComm)
                {
                    var res = new CommodityListRes(item);
                    commList.Add(res);
                }

                var pages = count / size;
                //总页数
                pages = pages * size == count ? pages : pages + 1;

                r.ListData = commList;
                r.index    = index;

                r.pages = pages;
                return(r);
            }
            return(null);
        }
 /// <summary>
 /// 根据分页筛选数据
 /// </summary>
 /// <param name="Key">主键</param>
 /// <param name="start">开始数据</param>
 /// <param name="PageSize">页面长度</param>
 /// <param name="desc">排序</param>
 /// <param name="model">对象</param>
 /// <returns>对象列表</returns>
 public List <Commodity_Stageprice_View> SelectByPage(string Key, int start, int PageSize, bool desc, Commodity_Stageprice_View model, string SelectFiled)
 {
     return(Commodity_Stageprice_ViewOper.Instance.SelectByPage(Key, start, PageSize, desc, model));
 }
示例#17
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCountForCommList(Commodity_Stageprice_View model = null, IDbConnection connection = null, IDbTransaction transaction = null, List <int> ids = null, int?sales = null)
        {
            var temp  = ids.ConvertAll(x => x.ToString());
            var query = new LambdaQuery <Commodity_Stageprice_View>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id.In(temp));
                }
                if (!model.Sales.IsNullOrEmpty())
                {
                    query.Where(p => p.Sales >= sales);
                }



                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.Image.IsNullOrEmpty())
                {
                    query.Where(p => p.Image == model.Image);
                }
                if (!model.GradeId.IsNullOrEmpty())
                {
                    query.Where(p => p.GradeId == model.GradeId);
                }
                if (!model.FrontView.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontView == model.FrontView);
                }
                if (!model.BackView.IsNullOrEmpty())
                {
                    query.Where(p => p.BackView == model.BackView);
                }
                if (!model.PrintingMethod.IsNullOrEmpty())
                {
                    query.Where(p => p.PrintingMethod == model.PrintingMethod);
                }
                if (!model.Color.IsNullOrEmpty())
                {
                    query.Where(p => p.Color == model.Color);
                }
                if (!model.Content.IsNullOrEmpty())
                {
                    query.Where(p => p.Content == model.Content);
                }

                if (!model.CreateTime.IsNullOrEmpty())
                {
                    query.Where(p => p.CreateTime == model.CreateTime);
                }
                if (!model.RecommendTime.IsNullOrEmpty())
                {
                    query.Where(p => p.RecommendTime == model.RecommendTime);
                }
                if (!model.Points.IsNullOrEmpty())
                {
                    query.Where(p => p.Points == model.Points);
                }
                if (!model.IsRelease.IsNullOrEmpty())
                {
                    query.Where(p => p.IsRelease == model.IsRelease);
                }
                if (!model.LastOperTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperTime == model.LastOperTime);
                }
                if (!model.LastOperId.IsNullOrEmpty())
                {
                    query.Where(p => p.LastOperId == model.LastOperId);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.ClickCount.IsNullOrEmpty())
                {
                    query.Where(p => p.ClickCount == model.ClickCount);
                }
                if (!model.Stars.IsNullOrEmpty())
                {
                    query.Where(p => p.Stars == model.Stars);
                }
                if (!model.StarCount.IsNullOrEmpty())
                {
                    query.Where(p => p.StarCount == model.StarCount);
                }
                if (!model.Introduce.IsNullOrEmpty())
                {
                    query.Where(p => p.Introduce == model.Introduce);
                }
                if (!model.ImageList.IsNullOrEmpty())
                {
                    query.Where(p => p.ImageList == model.ImageList);
                }
                if (!model.minPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.minPrice == model.minPrice);
                }
                if (!model.maxPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.maxPrice == model.maxPrice);
                }
                if (!model.minAmount.IsNullOrEmpty())
                {
                    query.Where(p => p.minAmount == model.minAmount);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
 /// <summary>
 /// 筛选全部数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public List <Commodity_Stageprice_View> SelectByModel(Commodity_Stageprice_View model)
 {
     return(Commodity_Stageprice_ViewOper.Instance.SelectAll(model));
 }