public BasePageList<CustModel> GetCustPageList(CustQueryModel query)
{
const string spName = "sp_common_pager";
const string tableName = @"cust_info";
const string fields = "innerid, custname, password, mobile, telephone, email, headportrait, status, authstatus, provid, cityid, area, sex, brithday, qq, totalpoints, level, qrcode, type, createdtime, modifiedtime,(select count(1) from car_info where custid=cust_info.innerid and status<>0) as carnum";
var orderField = string.IsNullOrWhiteSpace(query.Order) ? "createdtime desc" : query.Order;
//查询条件
var sqlWhere = new StringBuilder("1=1");
sqlWhere.Append(query.Status != null
? $" and status={query.Status}"
: "");
//会员ID
//if (!string.IsNullOrWhiteSpace(query.innerid))
//{
// sqlWhere.Append($" and cityid in (select cityid from sys_user_city where userid='{query.innerid}')");
//}
//手机号
if (!string.IsNullOrWhiteSpace(query.Mobile))
{
sqlWhere.Append($" and mobile like '%{query.Mobile}%'");
}
//昵称
if (!string.IsNullOrWhiteSpace(query.Custname))
{
sqlWhere.Append($" and custname like '%{query.Custname}%'");
}
var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
var list = Helper.ExecutePaging<CustModel>(model, query.Echo);
return list;
}