SearchItem

功能描述

查询条件的实体定义

属性
属性名 类型 说明
Name string 数据库中的字段名
Value string 指定数据源
Operator string 匹配方式
Method string 条件组合方式
SubSearchItems List<SearchItem> 子条件,分组查询或复杂查询时使用
注意事项
  • Operator 支持如下字符:Range,Equal,Intequal,NotEqual,Like,In,Intin,NotIn,Contains,NotIntequal,NotLike,NotIntin,NotContains,NotExist ,> & >= & < & <=

  • Method 支持如下字符:

    AND,OR

示例

下面的示例表达的条件为:

1.IsDeleted=0 and (ms1 in ["国家"] or ms2 in ["篮球","音乐"])

2.查询某个时间段多个状态并且不等于某个值并且某个值存在特定值

1.[
    {
        "Method": "",
        "Name": "IsDeleted",
        "Operator": "Equal",
        "Value": "0"
    },
    {
        "Method": "And",
        "SubSearchItems": [
            {
                "Method": "", //注意此处的method不允许为null
                "Name": "ms1",
                "Operator": "in",
                "Value": "国家"
            },
            {
                "Method": "Or",  //存在多个searchItem时,后者的method有效
                "Name": "ms2",
                "Operator": "In",
                "Value": "篮球|C4|音乐"
            }
        ]
    }
]
2.
var TimeRange =
Math.Ceiling(DateTime.Now.AddDays(-30).ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds).ToString()+"|C4|" +Math.Ceiling(DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds).ToString();
var pssearchitems = new List<SearchItem>(){
 new SearchItem(){Method = "And",Operator = "In",Name = "C4-WorkflowStateDisplayName",Value = "4. Closed|C4|3. Pending For Submitter Verify|C4|2. Pending For QA Verify"},
  new SearchItem(){Method = "And",Operator = "Range",Name = "C4-ModifyDate",Value = TimeRange },
   new SearchItem(){Method = "And",Operator = "NotEqual",Name = "AssigneeName",Value = "Viki Wang" },
   //  new SearchItem(){Method = "And",Operator = "Equal",Name = "BatchNum",Value = "202009-5" },
    new SearchItem(){Method = "And",Operator = "Like",Name = "BatchNum",Value = "202108-2" },
};
var od = new Dictionary<string, OrderMethod>(){
  {"C4-WorkflowStateDisplayName", OrderMethod.Ascending},
};
© Digital Maker Product Team all right reserved,powered by Gitbook该文件修订时间: 2023-02-02 10:40:12

results matching ""

    No results matching ""