public BasePageList<CustRelationsCarViewModel> GetHaveCarCustList(CustRelationsCarQueryModel query) { return _service.GetHaveCarCustList(query); }
/// <summary> /// 社交圈搜车 /// </summary> /// <param name="query">查询条件</param> /// <returns></returns> public BasePageList<CustRelationsCarViewModel> GetHaveCarCustList(CustRelationsCarQueryModel query) { const string spName = "sp_common_pager"; const string tableName = @"car_info as a inner join cust_info as b on a.custid=b.innerid left join base_carmodel as c3 on a.model_id=c3.innerid left join cust_wechat as c on a.custid=c.custid left join wechat_friend as d on d.openid=c.openid left join base_city as ct on b.cityid=ct.innerid "; const string fields = "b.innerid, b.custname, b.mobile, b.email, b.headportrait,d.photo ,c3.modelname as model_name,ct.cityname as custcityname"; var orderField = string.IsNullOrWhiteSpace(query.Order) ? "a.createdtime desc" : query.Order; #region 查询条件 var sqlWhere = new StringBuilder("1=1"); if (query.model_id != null) { sqlWhere.Append($" and a.model_id='{query.model_id}'"); } //会员所在省份 if (query.custprovid != null) { sqlWhere.Append($" and b.provid={query.custprovid}"); } //会员所在城市 if (query.cuscityid != null) { sqlWhere.Append($" and b.cityid={query.cuscityid}"); } #endregion var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex); var list = Helper.ExecutePaging<CustRelationsCarViewModel>(model, query.Echo); return list; }