Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

想问下同样一套代码,一套是测试环境一套是正式环境数据量差一倍,一个2万一个4万数据 #1

Open
52dotnetcore opened this issue Jul 28, 2020 · 2 comments

Comments

@52dotnetcore
Copy link

想问下同样一套代码,一套是测试环境一套是正式环境数据量差一倍,一个2万一个4万数据,查询某个字段存在速度差,测试环境查询产品负责人很快,正式环境很慢,需要两三分钟,代码是查询类别 自动生成的、
image

@52dotnetcore
Copy link
Author

image
这是代码部分

@52dotnetcore
Copy link
Author

public List GetDataList(string condition, string keyword, string testType, string tags, bool? isNullComment, string channel, DateTime? orderTimeMin, DateTime? orderTimeMax, DateTime? refundTimeMin, DateTime? refundTimeMax, DateTime? commentTimeMin, DateTime? commentTimeMax, DateTime? issueTimeMin, DateTime? issueTimeMax, int? isRefund, int? issueType, Pagination pagination, int isCheck, string customerId)
{
pagination.SortField = "OrderTime,CreateTime";
pagination.SortType = "desc,desc";
var whereExp = LinqHelper.True();
Expression<Func<Testing, Customer, Product, TestingDTO>> select = (a, b, c) => new TestingDTO
{
CustomerTags = b.Tags,
ProductURL = c.ProductURL
};
select = select.BuildExtendSelectExpre();
var q = from a in GetIQueryable().AsExpandable()
join b in Service.GetIQueryable() on a.CustomerName equals b.CustomerName into ab
from b in ab.DefaultIfEmpty()
join c in Service.GetIQueryable() on a.ProductName equals c.ProductName into abc
from c in abc.DefaultIfEmpty()
select @select.Invoke(a, b, c);
//模糊查询
if (!condition.IsNullOrEmpty() && !keyword.IsNullOrEmpty())
{
switch (condition)
{
case "ProductName":
whereExp = whereExp.And(x => x.ProductName == keyword);
break;
case "OrderId":
whereExp = whereExp.And(x => x.OrderId == keyword);
break;
case "CustomerName":
whereExp = whereExp.And(x => x.CustomerName == keyword);
break;
case "Paypal":
whereExp = whereExp.And(x => x.Paypal == keyword);
break;
case "OrderDutyMan":
whereExp = whereExp.And(x => x.OrderDutyMan == keyword);
break;
case "PutCountry":
whereExp = whereExp.And(x => x.PutCountry == keyword);
break;
case "ProductDutyMan":
whereExp = whereExp.And(x => x.ProductDutyMan == keyword);
break;
case "Remark":
whereExp = whereExp.And(x => x.Remark.Contains(keyword));
break;
default:
break;
}
}
return q.Where(whereExp).GetPagination(pagination).ToList();
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant