}
return br;
}
private Object getObject(String name) throws IOException {
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
if(name.lastIndexOf(".ftl")==-1){//判断是否为include的模板
//如果是主表直接走一对多模板
CgFormHeadEntity head = cgFormFieldService.getCgFormHeadByTableName(name);
if(head==null)return null;
if(head.getJformType()==CgAutoListConstant.JFORM_TYPE_MAIN_TALBE){
Resource[] resources = patternResolver.getResources(TEMPLET_ONE_MANY);
InputStreamReader inputStreamReader =null;
if (resources != null && resources.length > 0) {
inputStreamReader = new InputStreamReader(resources[0].getInputStream(),"UTF-8");
}
return inputStreamReader;
}
//1、根据table name 查询cgformftl 有则获取模板内容
//2、没有cgformftl 则查询cgformfield 根据cgformfield生成模板
Map<String,Object> cgformFtlEntity = cgformFtlService.getCgformFtlByTableName(name);
if(cgformFtlEntity!=null){
String content = (String) (cgformFtlEntity.get("ftl_content")==null?"":cgformFtlEntity.get("ftl_content"));
content = initFormHtml( content, name);
org.jeecgframework.core.util.LogUtil.info(content);
return new StringBuilder(content);
}else{
Resource[] resources = patternResolver.getResources(TEMPLET);
InputStreamReader inputStreamReader =null;
if (resources != null && resources.length > 0) {
inputStreamReader = new InputStreamReader(resources[0].getInputStream(),"UTF-8");
}
return inputStreamReader;
}
}else{
Resource[] resources = patternResolver.getResources(name);
InputStreamReader inputStreamReader =null;
if (resources != null && resources.length > 0) {
inputStreamReader = new InputStreamReader(resources[0].getInputStream(),"UTF-8");
}
return inputStreamReader;