递归调用

 1 /**
2 * 查询上下限流水
3 * @param fdbs
4 * @param startRq
5 * @param endRq
6 * @return
7 * @throws ServiceException
8 */
9 public Pagination<ProUpperLowerLimitLogDto> getProUpperLowerList(String fdbs, String startRq, String endRq,Pagination<ProUpperLowerLimitLogDto> pagination) throws ServiceException{
10
11 String[] fdbsStrings = null;
12 //如果fdbs为空,则得到登录人员机构下的所有分店!
13 if(UtilHelper.isEmpty(fdbs)){
14 List<String> fdbsStrList = new ArrayList<String>();
15 List<OmBizOrgTreeDto> omList = omBizOrgService.queryBizOrgTree();
16 this.getFdbsOfCurrentFdbs(omList,fdbsStrList);
17 fdbsStrings = fdbsStrList.toArray(new String[fdbsStrList.size()]);
18 }else{
19 fdbsStrings = fdbs.split(",");
20 }
21 return proUpperLowerLimitLogDao.getProUpperLowerList(startRq, endRq,pagination,fdbsStrings);
22 }
23
24 /**
25 * 处理分店标识
26 * @param list
27 * @param fdbsStrList
28 * @throws ServiceException
29 * Method Generated by wwei on 2011-12-15 下午07:38:06
30 */
31 private void getFdbsOfCurrentFdbs(List<OmBizOrgTreeDto> list,List<String> fdbsStrList ) throws ServiceException {
32 if(!UtilHelper.isEmpty(list)){
33 for (int i = 0; i < list.size(); i++) {
34 OmBizOrgTreeDto dto = list.get(i);
35
36 String fdbsStr= UtilHelper.trim(dto.getOrgCode());
37 if(!fdbsStrList.contains(fdbsStr)){
38 fdbsStrList.add(fdbsStr);
39 }
40
41 List<OmBizOrgTreeDto> childList = new ArrayList<OmBizOrgTreeDto>();
42 childList = dto.getChildren();
43 if(!UtilHelper.isEmpty(childList)){
44 this.getFdbsOfCurrentFdbs(childList,fdbsStrList);
45 }
46 }
47 }
48 }
49
原文地址:https://www.cnblogs.com/csuwangwei/p/2289339.html