我有一个原始的 Cayenne 表达式
(effectiveDate >= 01/01/2015) and ((specialFeaturesString like "*808*") and ((amortizationType = "05") or (amortizationType = "06")) and (loanType = 2))
我的代码库中有一个 util 方法可以将上述表达式转换为 HashMap。我遍历地图并转换为 JSON 格式并将该 JSON 提供给 jquery QueryBuilder。我在 UI 层更改 JSON 并使用 Jackson 将 JSON 转换为 HashMap HashMap sysout 如下
{condition=AND, rules=[{id=effectiveDate, field=effectiveDate, type=date, input=text, operator=greater_or_equal, value=04/05/2016}, {condition=AND, rules=[{id=specialFeaturesString, field=specialFeaturesString, type=string, input=text, operator=contains, value="*808*"}, {condition=OR, rules=[{id=amortizationType, field=amortizationType, type=string, input=select, operator=equal, value=05}, {id=amortizationType, field=amortizationType, type=string, input=select, operator=equal, value=06}]}, {id=loanType, field=loanType, type=string, input=select, operator=equal, value=2}]}]}
我需要遍历 HashMap 并将其转换为 Cayenne Expression。
最终结果应该是
(effectiveDate >= 04/05/2016) and ((specialFeaturesString like "*808*") and ((amortizationType = "05") or (amortizationType = "06")) and (loanType = 2))
请提供代码