private void ConverterDynamicQueryParamGroupFieldName(DynamicQueryParamGroup newGroup, DynamicQueryParamGroup old) { if (newGroup == null) { throw new ArgumentNullException(nameof(newGroup)); } if (old == null) { throw new ArgumentNullException(nameof(old)); } newGroup.Relation = old.Relation; if (old.Params != null && old.Params.Any()) { foreach (var item in old.Params) { var param = new DynamicQueryParam(); param.Operator = item.Operator; param.Field = FieldConverter(item.Field); //处理特殊情况any if (item.Operator == QueryOperation.Any) { var anyGroup = JsonConvert.DeserializeObject <DynamicQueryParamGroup>(item.Value?.ToString() ?? ""); var newAnyGroup = new DynamicQueryParamGroup(); ConverterDynamicQueryParamGroupFieldName(newAnyGroup, anyGroup); param.Value = JsonConvert.SerializeObject(newAnyGroup); } else { param.Value = item.Value; } newGroup.Params.Add(param); } } if (old.ChildGroups != null && old.ChildGroups.Any()) { foreach (var childGroup in old.ChildGroups) { var newChildGroup = new DynamicQueryParamGroup(); ConverterDynamicQueryParamGroupFieldName(newChildGroup, childGroup); newGroup.ChildGroups.Add(newChildGroup); } } }
private DynamicQueryParamBuilder Add(DynamicQueryParam param) { _params.Add(param); return(this); }