private GetBuilder <ShopBrandApplyInfo> WhereBuilder(BrandApplyQuery query) { var db = DbFactory.Default.Get <ShopBrandApplyInfo>(); if (query.AuditStatus.HasValue) { var status = (int)query.AuditStatus.Value; db.Where(item => item.AuditStatus == status); } if (query.ShopId.HasValue) { db.Where(a => a.ShopId == query.ShopId.Value); var childSql = DbFactory.Default .Get <BrandInfo>().Where <ShopBrandApplyInfo>((b, s) => s.ShopId == query.ShopId.Value && ((b.IsDeleted == false && s.BrandId == b.Id) || (s.BrandId.ExIfNull(0) == 0))); db.Where(item => item.ExExists(childSql)); } if (!string.IsNullOrEmpty(query.Keywords)) { var sbisql = DbFactory.Default .Get <ShopInfo>() .Where <ShopBrandApplyInfo>((s, b) => b.ShopId == s.Id && s.ShopName.Contains(query.Keywords)) .Select(n => n.Id); db.Where(item => item.ExExists(sbisql)); } return(db); }
public int GetShopBrandApplyCount(BrandApplyQuery query) { var db = WhereBuilder(query); return(db.Count()); }
public static int GetShopBrandApplyCount(BrandApplyQuery query) { return(Service.GetShopBrandApplyCount(query)); }