/// <summary> /// 获取分页列表 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="pageSize">分页大小</param> /// <param name="title">标题 - 搜索项</param> /// <returns></returns> public PageList <Store> GetPageList(int pageIndex, int pageSize, string areaCode, string name) { using (DbRepository db = new DbRepository()) { var query = db.Store.Where(x => !x.IsDelete); if (name.IsNotNullOrEmpty()) { query = query.Where(x => x.Name.Contains(name)); } if (areaCode.IsNotNullOrEmpty() && areaCode != "-1") { query = query.Where(x => x.CityCode.Contains(areaCode)); } var count = query.Count(); var list = query.OrderByDescending(x => x.CreatedTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); var areaDic = IDataDictionaryService.CacheDic(); list.ForEach(x => { if (areaDic.ContainsKey(GroupCode.Area) && x.CityCode.IsNotNullOrEmpty() && areaDic[GroupCode.Area].ContainsKey(x.CityCode)) { x.CityName = areaDic[GroupCode.Area][x.CityCode].Value; } }); return(CreatePageList(list, pageIndex, pageSize, count)); } }