首页 > 代码库 > 过滤及查询

过滤及查询

1、 建立过滤条件,分录上的F7过滤

KDBizPromptBox prmt = (KDBizPromptBox) this.kdtEntrys.getColumn("feeType").getEditor().getComponent();

EntityViewInfo view = new EntityViewInfo();
FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
filterInfo.getFilterItems().add(new FilterItemInfo("number", "108", CompareType.EQUALS));
view.setFilter(filterInfo);
prmt.setEntityViewInfo(view);

2、通用查询

EntityViewInfo evi = new EntityViewInfo();

SelectorItemCollection selector = evi.getSelector();

selector.add(new SelectorItemInfo("id"));
selector.add(new SelectorItemInfo("startDate"));
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("accountDate", endAccountDate, CompareType.GREATER));
evi.setFilter(filter);
3、跟1差不多,表头F7过滤

EntityViewInfo view = new EntityViewInfo();
FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
filterInfo.getFilterItems().add(new FilterItemInfo("number", number, CompareType.GREATER_EQUALS));
view.setFilter(filterInfo);
prmtaccountTo.setEntityViewInfo(view);
prmtaccountTo.getQueryAgent().resetRuntimeEntityView();

4、带or过滤条件,如果不设setMaskString,则默认为and

EntityViewInfo view = new EntityViewInfo();
FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
filterInfo.getFilterItems().add(new FilterItemInfo("number", "001", CompareType.EQUALS));
filterInfo.getFilterItems().add(new FilterItemInfo("number", "005", CompareType.EQUALS));
filterInfo.setMaskString("#0 or #1");//条件为or (设置过滤条件之间的关系,不设置setMaskString时,默认为and)
view.setFilter(filterInfo);
prmt.setEntityViewInfo(view);

过滤及查询