金蝶EAS Web端列表界面添加过滤条件,如果是BOTP查看,则不设置任何过滤条件
作者:互联网
public class TestFilterHandler extends Object implements IWebListDataEventHandler {
@Override
public void onRequest(WebListDataEvent event) throws WafException, BOSException {
ModelMap modelMap = event.getReqeustContext().get(ModelMap.class);
HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
boolean isBotp = request.getParameterMap().containsKey("botpFilterItems");
if(isBotp){//如果是BOTP查看,则不设置任何过滤条件
return;
}
EntityViewInfo entityViewInfo = (EntityViewInfo) modelMap.get("DataGridEntityView");
if (entityViewInfo == null) {
entityViewInfo = new EntityViewInfo();
}
Context ctx = WafContext.getInstance().getContext();
FilterInfo filter = new FilterInfo();
CompanyOrgUnitInfo companyInfo = ContextUtil.getCurrentFIUnit(ctx);
if(companyInfo.isIsBizUnit()){
filter.getFilterItems().add(new FilterItemInfo("company.id", companyInfo.getId()));
} else {
filter.getFilterItems().add(new FilterItemInfo("id", "null"));
}
entityViewInfo.setFilter(filter);
modelMap.put("DataGridEntityView", entityViewInfo);
}
}
标签:Web,entityViewInfo,modelMap,filter,EntityViewInfo,过滤,BOTP,new,event 来源: https://blog.csdn.net/sinat_21634237/article/details/112600501