public IQueryable<ServiceOrderDetailEntity> GetServiceOrderDetailsByCondition(ServiceOrderDetailSearchCondition condition)
		{
			var query = _serviceorderdetailRepository.Table;
			try
			{
				if (condition.CountBegin.HasValue)
                {
                    query = query.Where(q => q.Count>= condition.CountBegin.Value);
                }
                if (condition.CountEnd.HasValue)
                {
                    query = query.Where(q => q.Count < condition.CountEnd.Value);
                }
				if (condition.PriceBegin.HasValue)
                {
                    query = query.Where(q => q.Price>= condition.PriceBegin.Value);
                }
                if (condition.PriceEnd.HasValue)
                {
                    query = query.Where(q => q.Price < condition.PriceEnd.Value);
                }
                if (condition.Status.HasValue)
                {
                    query = query.Where(q => q.ServiceOrder.Status == condition.Status.Value);
                }
				if (condition.Ids != null && condition.Ids.Any())
                {
                    query = query.Where(q => condition.Ids.Contains(q.Id));
                }
				if (condition.ServiceOrders != null && condition.ServiceOrders.Any())
                {
                    query = query.Where(q => condition.ServiceOrders.Contains(q.ServiceOrder));
                }
				if (condition.Products != null && condition.Products.Any())
                {
                    query = query.Where(q => condition.Products.Contains(q.Product));
                }
				if(condition.OrderBy.HasValue)
				{
					switch (condition.OrderBy.Value)
                    {
						case EnumServiceOrderDetailSearchOrderBy.OrderById:
							query = condition.IsDescending?query.OrderByDescending(q=>q.Id):query.OrderBy(q=>q.Id);
							break;
                    }
					
				}
				else
				{
					query = query.OrderBy(q=>q.Id);
				}

				if (condition.Page.HasValue && condition.PageCount.HasValue)
                {
                    query = query.Skip((condition.Page.Value - 1)*condition.PageCount.Value).Take(condition.PageCount.Value);
                }
				return query;
			}
			catch(Exception e)
			{
				_log.Error(e,"数据库操作出错");
                return null;
			}
		}
		public int GetServiceOrderDetailCount (ServiceOrderDetailSearchCondition condition)
		{
			var query = _serviceorderdetailRepository.Table;
			try
			{
				if (condition.CountBegin.HasValue)
                {
                    query = query.Where(q => q.Count>= condition.CountBegin.Value);
                }
                if (condition.CountEnd.HasValue)
                {
                    query = query.Where(q => q.Count < condition.CountEnd.Value);
                }
				if (condition.PriceBegin.HasValue)
                {
                    query = query.Where(q => q.Price>= condition.PriceBegin.Value);
                }
                if (condition.PriceEnd.HasValue)
                {
                    query = query.Where(q => q.Price < condition.PriceEnd.Value);
                }
				if (condition.Ids != null && condition.Ids.Any())
                {
                    query = query.Where(q => condition.Ids.Contains(q.Id));
                }
				if (condition.ServiceOrders != null && condition.ServiceOrders.Any())
                {
                    query = query.Where(q => condition.ServiceOrders.Contains(q.ServiceOrder));
                }
				if (condition.Products != null && condition.Products.Any())
                {
                    query = query.Where(q => condition.Products.Contains(q.Product));
                }
				return query.Count();
			}
			catch(Exception e)
			{
				_log.Error(e,"数据库操作出错");
                return -1;
			}
		}