车辆悬赏查询实体
상속: QueryModel
예제 #1
0
 public BasePageList<CarRewardViewModel> CarRewardPageList(CarRewardQueryModel query)
 {
     return _carervice.CarRewardPageList(query);
 }
예제 #2
0
 public BasePageList<CarInfoListViewModel> GetCarRewardPageList(CarRewardQueryModel query)
 {
     return _carervice.GetCarRewardPageList(query);
 }
예제 #3
0
        /// <summary>
        /// 车辆悬赏列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BasePageList<CarRewardViewModel> CarRewardPageList(CarRewardQueryModel query)
        {
            const string spName = "sp_common_pager";
            const string tableName = @"car_reward as a
                                    left join base_carbrand as b on b.innerid = a.brand_id
                                    left join base_carseries as c on c.innerid = a.series_id
                                    left join base_carmodel as d on d.innerid = a.model_id
                                    left join base_province as e on e.innerid = a.provid
                                    left join base_city as f on f.innerid = a.cityid
                                    left join base_code as bc on a.colorid=bc.codevalue and bc.typekey='car_color'";
            const string fields = "a.*,b.brandname,b.logurl,c.seriesname,d.modelname,e.provname,f.cityname,bc.codename as color ";
            var orderField = string.IsNullOrWhiteSpace(query.Order) ? "a.createdtime desc" : query.Order;
            var sqlWhere = new StringBuilder(" 1=1 ");
            //品牌
            if (query.brand_id.HasValue)
            {
                sqlWhere.Append($" and a.brand_id={query.brand_id}");
            }

            //车系
            if (query.series_id.HasValue)
            {
                sqlWhere.Append($" and a.series_id={query.series_id}");
            }
            //车型
            if (query.model_id.HasValue)
            {
                sqlWhere.Append($" and a.model_id={query.model_id}");
            }

            //省份
            if (query.provid.HasValue)
            {
                sqlWhere.Append($" or a.provid={query.provid}");
            }

            //城市
            if (query.cityid.HasValue)
            {
                sqlWhere.Append($" or a.cityid={query.cityid}");
            }

            //价格
            if (!string.IsNullOrWhiteSpace(query.price))
            {
                sqlWhere.Append($" and  a.price='{query.price}' ");
            }

            //里程
            if (!string.IsNullOrWhiteSpace(query.mileage))
            {
                sqlWhere.Append($" and  a.mileage ='{query.mileage}' )");
            }

            //车龄
            if (!string.IsNullOrWhiteSpace(query.coty))
            {
                sqlWhere.Append($" or ( a.coty<='{query.coty}'");
            }
            var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
            var list = Helper.ExecutePaging<CarRewardViewModel>(model, query.Echo);
            return list;
        }