对EntityViewInfo的理解
1,EntityViewInfo常常用作bos中接口参数,来做查询用,其中包含了FilterInfo(过滤)、Selector(指定属性)以及Sorter(排序)
1 SelectorItemCollection sic = new SelectorItemCollection(); 2 3 //表示获取info所有的属性 4 5 sic.add(newSelectorItemInfo("*")); 6 7 //表示获取info上creator上所有的属性 8 9 sic.add(newSelectorItemInfo("creator.*")); 10 11 //表示只获取info上auditor上id,name和number三个属性 12 13 sic.add(new SelectorItemInfo("auditor.id")); 14 15 sic.add(newSelectorItemInfo("auditor.number")); 16 17 sic.add(newSelectorItemInfo("auditor.name")); 18 19 特殊的 20 XXXFactory.getRemoteInstance().getXXXInfo(IObjectPKpk);//直接获取info,如果info中含有关联属性,只能取到关联属性的ID 21 22 XXXFactory.getRemoteInstance().getXXXInfo(IObjectPKpk, SelectorItemCollection selector);//直接获取Info,通过在selector中指定需要取哪些属性,比如
2,AtsOverTimeBillEditHandler.class中案例,加上自己的理解.
1 EntityViewInfo EntityViewInfo = new EntityViewInfo();//新建接口 2 SelectorItemCollection sic = new SelectorItemCollection(); //通过Selector设定属性 3 sic.add(new SelectItemInfo("proposer.id"));//表示只获取info上proposer上id属性 4 sic.add(new SelectItemInfo("id"));//表示只获取info上id属性 5 sic.add(new SelectItemInfo("attendDate"));//表示只获取info上attendDate属性 6 sic.add(new SelectItemInfo("dayType"));//表示只获取info上dayType属性 7 entityViewInfo.setSelector(sic);//设置属性 8 FilterInfo filterInfo = new FilterInfo();//建立过滤条件 9 filterInfo.getFilterItems().add(new FilterItemInfo("proposer.id",personInfo.getId().toString())); 10 filterInfo.getFilterItems().add(new FilterItemInfo("attendDate",newDate,CompareType.GREATER_EQUALS)); 11 entityViewInfo.setFilter(filterInfo);//设置过滤条件
3,AtsOverTimeBillListHandler这个里面的代码补充
1 FilterInfo fla = new FilterInfo(); 2 fla.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("entries.otDate", beginDateTs, CompareType.GREATER_EQUALS)); 3 fla.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("entries.otDate", endDateTs, CompareType.LESS_EQUALS)); 4 5 FilterInfo flb1 = new FilterInfo(); 6 flb1.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("billState", Integer.valueOf(1), CompareType.EQUALS)); 7 FilterInfo flb2 = new FilterInfo(); 8 flb2.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("billState", Integer.valueOf(2), CompareType.EQUALS)); 9 FilterInfo flb3 = new FilterInfo(); 10 flb3.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("billState", Integer.valueOf(3), CompareType.EQUALS)); 11 String existsSql = "SELECT 1 FROM T_HR_ATS_AttendanceResult attenceResult WHERE attenceResult.FPROPOSERID = ENTRIES.FPERSONID AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') >= '" + beginDate + "'" + " AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') <= '" + endDate + "'" + " AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') = to_char(ENTRIES.fotDate,'YYYY-MM-DD')" + " AND attenceResult.FLASTUPDATETIME <= ATSOVERTIMEBILL.FLASTUPDATETIME"; 12 13 flb3.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("PERSON.ID", existsSql, CompareType.EXISTS)); 14 15 FilterInfo flb4 = new FilterInfo(); 16 flb4.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("billState", Integer.valueOf(3), CompareType.EQUALS)); 17 String notExistsSql = "SELECT 1 FROM T_HR_ATS_AttendanceResult attenceResult WHERE attenceResult.FPROPOSERID = ENTRIES.FPERSONID AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') >= '" + beginDate + "'" + " AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') <= '" + endDate + "'" + " AND to_char(attenceResult.Fattencedate,'YYYY-MM-DD') = to_char(ENTRIES.fotDate,'YYYY-MM-DD')"; 18 19 flb4.getFilterItems().add(new com.kingdee.bos.metadata.entity.FilterItemInfo("PERSON.ID", notExistsSql, CompareType.NOTEXISTS)); 20 21 FilterInfo flb = new FilterInfo(); 22 flb.mergeFilter(flb1, "OR"); //这是一个含有合并过滤(mergeFilter)的案例 可以是"OR" 23 flb.mergeFilter(flb2, "OR"); 24 flb.mergeFilter(flb3, "OR"); 25 flb.mergeFilter(flb4, "OR"); 26 27 filter.mergeFilter(fla, "AND");//这是一个含有合并过滤(mergeFilter)的案例 也可以是"and" 28 filter.mergeFilter(flb, "AND");
4,
给列表添加过滤条件:
http://blog.csdn.net/fenyu8/article/details/12085499
5,设置列表界面打开时查询的缺省过滤条件,返回null值屏蔽CU条件 getDefaultFilterForQuery
6,
//这是一种比较特殊的用法,目前,还不懂意思 protected FilterInfo getDefaultFilter(HttpServletRequest request, HttpServletResponse response) throws WafException { FilterInfo filterInfo = super.getDefaultFilter(request, response); filterInfo = AtsWebUtils.getDefaultOrgFilter(filterInfo); return filterInfo; }
7,
做EAS,包括shr要养成一个习惯:打补丁前备份整个服务器目录,有问题就还原
8, 其他的案例
http://blog.csdn.net/douml88/article/details/8855333
9,要是不会,就可以找找js源码解读