소스 검색

模块的生成代码支持

master
郑根木 2 년 전
부모
커밋
a593230e7d
2개의 변경된 파일26개의 추가작업 그리고 10개의 파일을 삭제
  1. +3
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  2. +23
    -10
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java

+ 3
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java 파일 보기

@@ -111,6 +111,9 @@ public class CodeBuildHandler extends AbstractHandler {
if (StringUtils.isNotEmpty(cn)) {
packageName += "." + cn;
}
String pn = ModelFormHelper.getFormParentName(form);
if (StringUtils.isNotEmpty(pn)) packageName += "." + pn;

codePath += packageName.replaceAll("\\.", "/");
new File(codePath).mkdirs();
}


+ 23
- 10
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java 파일 보기

@@ -232,7 +232,7 @@ public class ModelFormHelper {
field.put("linkDb", filter.linkDb);
field.put("linkField", filter.linkField);
field.put("value", filter.value);
field.put("trigger",filter.trigger);
field.put("trigger", filter.trigger);
}
}
}
@@ -386,6 +386,10 @@ public class ModelFormHelper {
String ep = moduleName;
String cn = ModelCatalogCache.getInstance().getFullName(bean.getMcId());
if (StringUtils.isNotEmpty(cn)) ep = ep + "." + cn;

String pn = ModelFormHelper.getFormParentName(bean);
if (StringUtils.isNotEmpty(pn)) ep += "." + pn;

return ep;
}
return "";
@@ -393,6 +397,7 @@ public class ModelFormHelper {

/**
* 根据向导生成model
*
* @param form
* @param tmplId
*/
@@ -422,7 +427,7 @@ public class ModelFormHelper {
}
String widgetRef = "";
if (!setWidget.isEmpty()) {
for (long s: setWidget) {
for (long s : setWidget) {
widgetRef += ",\"" + s + "\"";
}
widgetRef = widgetRef.substring(1);
@@ -490,23 +495,31 @@ public class ModelFormHelper {
return (form != null) ? form.getEntityId() : 0L;
}

//js文件的路径
public String getJsPath(ModelForm form) {
/*//js文件的路径
public static String getJsPath(ModelForm form) {
if (form == null) throw new BizException("页面定义对象不能为空!");
String moduleName = ModelProjectCache.getInstance().getModule(form.getPrjId());
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath());
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
String codeJavaPath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codeJavaPath)) {
if (mapIdeaModules == null || mapIdeaModules.isEmpty())
throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
String codePath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codePath)) {
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!");
}
codeJavaPath += "/src/main/resources/static/event/" + moduleName + "/";
codePath += "/src/main/resources/static/event/" + moduleName + "/";
//加上目录
String cn = ModelCatalogCache.getInstance().getFullName(form.getMcId());
if (StringUtils.isNotEmpty(cn)) {
codeJavaPath += cn.replaceAll("\\.", "/");
codePath += cn.replaceAll("\\.", "/");
}
return codeJavaPath;
return codePath;
}*/

public static String getFormParentName(ModelForm form) {
if (form.getParent() <= 0) return null;
ModelForm pf = ModelFormCache.getInstance().get(form.getParent());
if (pf != null) return pf.getName();
return null;
}
}

불러오는 중...
취소
저장