|
@@ -68,6 +68,7 @@ public class VelocityUtils
|
|
|
velocityContext.put("columns", genTable.getColumns());
|
|
velocityContext.put("columns", genTable.getColumns());
|
|
|
velocityContext.put("table", genTable);
|
|
velocityContext.put("table", genTable);
|
|
|
velocityContext.put("dicts", getDicts(genTable));
|
|
velocityContext.put("dicts", getDicts(genTable));
|
|
|
|
|
+ setExtensionsContext(velocityContext, genTable.getOptions());
|
|
|
setMenuVelocityContext(velocityContext, genTable);
|
|
setMenuVelocityContext(velocityContext, genTable);
|
|
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
|
|
{
|
|
{
|
|
@@ -80,6 +81,13 @@ public class VelocityUtils
|
|
|
return velocityContext;
|
|
return velocityContext;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static void setExtensionsContext(VelocityContext context, String options)
|
|
|
|
|
+ {
|
|
|
|
|
+ JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
|
+ boolean genView = genView(paramsObj);
|
|
|
|
|
+ context.put("genView", genView);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
|
|
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
|
|
|
{
|
|
{
|
|
|
String options = genTable.getOptions();
|
|
String options = genTable.getOptions();
|
|
@@ -134,8 +142,12 @@ public class VelocityUtils
|
|
|
* @param tplWebType 前端类型
|
|
* @param tplWebType 前端类型
|
|
|
* @return 模板列表
|
|
* @return 模板列表
|
|
|
*/
|
|
*/
|
|
|
- public static List<String> getTemplateList(String tplCategory, String tplWebType)
|
|
|
|
|
|
|
+ public static List<String> getTemplateList(GenTable table)
|
|
|
{
|
|
{
|
|
|
|
|
+ String tplWebType = table.getTplWebType();
|
|
|
|
|
+ String tplCategory = table.getTplCategory();
|
|
|
|
|
+ JSONObject paramsObj = JSONObject.parseObject(table.getOptions());
|
|
|
|
|
+ boolean isView = genView(paramsObj);
|
|
|
String useWebType = "vm/vue";
|
|
String useWebType = "vm/vue";
|
|
|
String apiTemplate = "vm/js/api.js.vm";
|
|
String apiTemplate = "vm/js/api.js.vm";
|
|
|
if (StringUtils.equals(ELEMENT_PLUS, tplWebType))
|
|
if (StringUtils.equals(ELEMENT_PLUS, tplWebType))
|
|
@@ -174,6 +186,10 @@ public class VelocityUtils
|
|
|
templates.add(useWebType + "/index.vue.vm");
|
|
templates.add(useWebType + "/index.vue.vm");
|
|
|
templates.add("vm/java/sub-domain.java.vm");
|
|
templates.add("vm/java/sub-domain.java.vm");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (isView)
|
|
|
|
|
+ {
|
|
|
|
|
+ templates.add(useWebType + "/view.vue.vm");
|
|
|
|
|
+ }
|
|
|
return templates;
|
|
return templates;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -253,6 +269,10 @@ public class VelocityUtils
|
|
|
{
|
|
{
|
|
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (template.contains("view.vue.vm"))
|
|
|
|
|
+ {
|
|
|
|
|
+ fileName = StringUtils.format("{}/views/{}/{}/view.vue", vuePath, moduleName, businessName);
|
|
|
|
|
+ }
|
|
|
return fileName;
|
|
return fileName;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -395,6 +415,21 @@ public class VelocityUtils
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 扩展功能/生成详情页
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param paramsObj 生成其他选项
|
|
|
|
|
+ * @return 是否生成详细页
|
|
|
|
|
+ */
|
|
|
|
|
+ public static boolean genView(JSONObject paramsObj)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (StringUtils.isNotNull(paramsObj) && paramsObj.containsKey(GenConstants.GEN_VIEW))
|
|
|
|
|
+ {
|
|
|
|
|
+ return paramsObj.getBoolean(GenConstants.GEN_VIEW);
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 获取树名称
|
|
* 获取树名称
|
|
|
*
|
|
*
|
|
|
* @param paramsObj 生成其他选项
|
|
* @param paramsObj 生成其他选项
|