public BasePageList<CarLoanViewModel> GetCarLoanList(CarLoanQueryModel query) { return _carervice.GetCarLoanList(query); }
/// <summary> /// 获取贷款列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public BasePageList<CarLoanViewModel> GetCarLoanList(CarLoanQueryModel query) { const string spName = "sp_common_pager"; const string tableName = @"car_loan as a left join cust_info as b on b.mobile=a.mobile"; const string fields = " a.*,ifnull(b.`level`,0) as `level` "; var orderField = string.IsNullOrWhiteSpace(query.Order) ? "a.createdtime desc" : query.Order; var sqlWhere = new StringBuilder(" 1=1 "); //联系电话 if (!string.IsNullOrWhiteSpace(query.mobile)) { sqlWhere.Append($" and a.mobile={query.mobile}"); } //联系人 if (!string.IsNullOrWhiteSpace(query.contacts)) { sqlWhere.Append($" and a.contacts={query.contacts}"); } var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex); var list = Helper.ExecutePaging<CarLoanViewModel>(model, query.Echo); return list; }