/// <summary> /// 获取已上报的行政村防汛防台形势图列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <VillagePicViewModel> GetVillagePicList(NoVerifyGetVillagePicList request) { using (var db = DbFactory.Open()) { var builder = db.From <VillagePic>(); if (request.year == 0) { throw new Exception("年度不正确"); } builder.LeftJoin <VillagePic, ADCDInfo>((x, y) => x.adcd == y.adcd); builder.Where(x => x.Year == request.year && x.adcd.StartsWith(adcd.Substring(0, 9)) && x.adcd != adcd); if (!string.IsNullOrEmpty(request.adnm)) { builder.And <ADCDInfo>(y => y.adnm.Contains(request.adnm)); } builder.Select <VillagePic, ADCDInfo>((x, y) => new { Id = x.Id, adcd = x.adcd, adnm = y.adnm, path = x.path, Year = x.Year, CreatTime = x.CreatTime, operateLog = x.operateLog }); var count = db.Select(builder).Count; if (!string.IsNullOrEmpty(request.Sort) && !string.IsNullOrEmpty(request.Order) && request.Order == "asc") { builder.OrderBy(x => request.Sort); } else if (!string.IsNullOrEmpty(request.Sort) && !string.IsNullOrEmpty(request.Order) && request.Order == "desc") { builder.OrderByDescending(x => request.Sort); } else { builder.OrderBy(x => x.adcd); } var rows = request.PageSize == 0 ? 10 : request.PageSize; var skip = request.PageIndex == 0 ? 0 : (request.PageIndex - 1) * rows; builder.Limit(skip, rows); var list = db.Select <VillagePicViewModel>(builder); return(new BsTableDataSource <VillagePicViewModel>() { total = count, rows = list }); } }
public BsTableDataSource <VillagePicViewModel> Get(NoVerifyGetVillagePicList request) { return(NoVerifyVillagePicManager.GetVillagePicList(request)); }