예제 #1
0
 public BasePageList<CarCollectionViewListModel> GetCollectionList(CarCollectionQueryModel query)
 {
     return _carervice.GetCollectionList(query);
 }
예제 #2
0
        /// <summary>
        /// 获取收藏的车辆列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BasePageList<CarCollectionViewListModel> GetCollectionList(CarCollectionQueryModel query)
        {
            const string spName = "sp_common_pager";
            const string tableName = @"car_collection as b
                                    inner join car_info as a on a.innerid=b.carid
                                    left join base_carbrand as c1 on a.brand_id=c1.innerid
                                    left join base_carseries as c2 on a.series_id=c2.innerid
                                    left join base_carmodel as c3 on a.model_id=c3.innerid
                                    left join base_city as ct on a.cityid=ct.innerid";
            var fields = "a.innerid,a.custid,a.pic_url,a.price,a.buyprice,a.dealprice,a.buytime,a.status,a.mileage,a.register_date," +
                         "c1.brandname as brand_name,c2.seriesname as series_name,c3.modelname as model_name,ct.cityname,b.remark,b.createdtime as Collectiontime," +
                         $" (select count(1) from cust_relations where userid='{query.Custid}' and friendsid=a.custid) as isfriend";
            var orderField = string.IsNullOrWhiteSpace(query.Order) ? "b.createdtime desc" : query.Order;

            #region 查询条件

            var sqlWhere = $"b.custid='{query.Custid}' and a.status<>0";

            #endregion

            var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
            var list = Helper.ExecutePaging<CarCollectionViewListModel>(model, query.Echo);
            return list;
        }