SearchItem
Function Description
Entity definition of search criteria.
Parameter
Parameter | Type | Remarks |
---|---|---|
Name | string | Field name in the database |
Value | string | Specified data source |
Operator | string | Matching method |
Method | string | Grouping method of conditions |
SubSearchItems | List<SearchItem> |
Sub search item, used for grouping search or complex search |
Note
Operator supports:
Range
,Equal
,Intequal
,NotEqual
,Like
,In
,Intin
,NotIn
,Contains
,NotIntequal
,NotLike
,NotIntin
,NotContains
,NotExist
,> & >= & < & <=
[warning] warning
Intin
,NotIntin
,Intequal
,NotIntequal
can only be applied to numeric fields,Range
,> & >= & < & <=
can only be applied to numeric or time type fieldsMethod supports:
AND
,OR
Sample
The following examples express the conditions:
1.IsDeleted=0 and (ms1 in ["country"] or ms2 in ["basketball","music"])
2.Query multiple states in a certain period of time and are not equal to a certain value and a certain value has a certain value
1.[
{
"Method": "",
"Name": "IsDeleted",
"Operator": "Equal",
"Value": "0"
},
{
"Method": "And",
"SubSearchItems": [
{
"Method": "", //the "method" is not allowed to be null
"Name": "ms1",
"Operator": "in",
"Value": "country"
},
{
"Method": "Or", //When there are multiple searchItems, the latter's method is valid.
"Name": "ms2",
"Operator": "In",
"Value": "basketball|C4|music"
}
]
}
]
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},
};