Skip to content

Instantly share code, notes, and snippets.

@24code
Created April 22, 2022 03:18
Show Gist options
  • Select an option

  • Save 24code/ffa11b3eccacaf2ccc5a117747f67358 to your computer and use it in GitHub Desktop.

Select an option

Save 24code/ffa11b3eccacaf2ccc5a117747f67358 to your computer and use it in GitHub Desktop.
查询template
var factory = new FilterConditionFactory<RecommendCodeV2>();
Condition condition = !factory.Term(r => r.StdIsDeleted, true);
if (param.Type != RecommendCodeType.Default)
{
condition = condition & factory.Term(r => r.Type, ((int)param.Type).ToString());
}
if (!string.IsNullOrEmpty(param.Value))
{
condition = condition & factory.Term(r => r.Value, param.Value);
}
if (param.Status != RecommendCodeStatus.Default)
{
condition = condition & factory.Term(r => r.Status, ((int)param.Status).ToString());
}
if (!string.IsNullOrEmpty(param.Referrer))
{
condition = condition & factory.Term(r => r.Referrer, param.Referrer);
}
var codes = queryProvider.Filter(f => condition).GetEntities();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment