      FormCacheManager formCacheManager = (FormCacheManager) AppContext.getBean(${doubleQuote}formCacheManager${doubleQuote});
      CAP4FormRelationActionManager cap4FormRelationActionManager = (CAP4FormRelationActionManager) AppContext.getBean(${doubleQuote}cap4FormRelationActionManager${doubleQuote});
      EnumManager enumManagerNew = (EnumManager) AppContext.getBean(${doubleQuote}enumManagerNew${doubleQuote});
      long targetFormId = MagicHandleFormUtils.getProviderFormId(${doubleQuote}${businessId}${doubleQuote}, ${doubleQuote}${versionId}${doubleQuote}, ${doubleQuote}${methodName}${doubleQuote});
      List<String> resultFieldList = new ArrayList<String>();
      ${resultFieldList}
      Map<String, Class<?>> resultDataClassMapp = new HashMap<String, Class<?>>();
      ${resultDataClassMapp}
      Map<String, Object> params = context.getExtAttrs();
      params.put(${doubleQuote}targetFormId${doubleQuote},targetFormId);
      params.put(${doubleQuote}toRelationAttr${doubleQuote},${doubleQuote}${toRelationAttr}${doubleQuote});
      params.put(${doubleQuote}customShowFields${doubleQuote}, resultFieldList);
      List<Map<String, Object>> newCondition = new ArrayList<Map<String,Object>>();
      if(condition != null) {
        for(int x = 0;x < condition.size();x ++){
            Map<String,Object> map = new HashMap<String, Object>();
            ${conditionName} c =  condition.get(x);
            map.put(${doubleQuote}aliasTableName${doubleQuote},c.getAliasTableName());
            map.put(${doubleQuote}fieldName${doubleQuote},c.getFieldName());
            map.put(${doubleQuote}fieldValue${doubleQuote},c.getFieldValue());
            map.put(${doubleQuote}leftChar${doubleQuote},c.getLeftChar());
            map.put(${doubleQuote}operation${doubleQuote},c.getOperation());
            map.put(${doubleQuote}rightChar${doubleQuote},c.getRightChar());
            map.put(${doubleQuote}rowOperation${doubleQuote},c.getRowOperation());
            newCondition.add(map);
        }
      }
      FlipInfo flipInfo = null;
      try {
        
        flipInfo = MagicHandleCAP3FormUtils.getReletionList2Magic(params, newCondition, page, pageSize,selectedToMasterDataId);
        
      } catch (BusinessException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
       }
      List relationDatas = flipInfo.getData();
      if (flipInfo.getPage() != page) {
         // 平台JDBC查询，当页数超过总页数还是为默认返回上一页的数据。无JDBC源码，单独在此处处理
           relationDatas = new ArrayList();
      }

      FormBean toFormBean = formCacheManager.getForm(targetFormId);
      ${resultListDefineName} result = new ${resultListDefineName}();
      if(toFormBean == null) {
         return result;
      }
      result.setTotal(flipInfo.getTotal());
      result.setTargetFormType(toFormBean.getFormType());
      result.setTargetFormId(targetFormId);
      List<${resultListItemEntityName}> listDatas = new ArrayList<${resultListItemEntityName}>(relationDatas.size());
       for (int i = 0; i < relationDatas.size(); i++) {
           Map relationData = (Map) relationDatas.get(i);
           ${resultListItemEntityName} resultData = new ${resultListItemEntityName}();

           Object vs ;
           FormFieldBean toFormFieldBean;
           Object[] values;
           try {
               ${resultValueSetItem}
           } catch (NumberFormatException e) {
               throw new BusinessException(e);
           } catch (BusinessException e) {
               throw new BusinessException(e);
           }

           listDatas.add(resultData);
       }
      result.setData(listDatas );
      return result;