在action中find_all方法中,加入以下代码:
//根据输入的查询字模糊查询
if(searchWord!=null && !"".equals(searchWord)){
if(condition ==null){
condition = new Condition();
}
ConditionRule cr1 = new ConditionRule("sysName",searchWord,Condition.Mode.CONTAIN,Condition.Type.AND);
ConditionRule cr2 = new ConditionRule("projectName",searchWord,Condition.Mode.CONTAIN,Condition.Type.OR);
ConditionRuleGroup crg = new ConditionRuleGroup();
crg.addRule(cr1,cr2);
condition.addRuleGroup(crg);
}
若想实现时间排序,按照时间最近的在前面:
Ordinal ordinal= OrdinalUtil.createOrdinal(this,new String []{"creatorDate:DESC"},null);