|
|
|
@ -58,6 +58,7 @@ public class VelocityUtils
|
|
|
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
|
|
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
|
|
|
velocityContext.put("columns", genTable.getColumns());
|
|
|
|
velocityContext.put("columns", genTable.getColumns());
|
|
|
|
velocityContext.put("table", genTable);
|
|
|
|
velocityContext.put("table", genTable);
|
|
|
|
|
|
|
|
setExtensionsContext(velocityContext, genTable.getOptions());
|
|
|
|
setMenuVelocityContext(velocityContext, genTable);
|
|
|
|
setMenuVelocityContext(velocityContext, genTable);
|
|
|
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
|
|
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -70,6 +71,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();
|
|
|
|
@ -123,8 +131,11 @@ public class VelocityUtils
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return 模板列表
|
|
|
|
* @return 模板列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static List<String> getTemplateList(String tplCategory)
|
|
|
|
public static List<String> getTemplateList(GenTable table)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
String tplCategory = table.getTplCategory();
|
|
|
|
|
|
|
|
JSONObject paramsObj = JSONObject.parseObject(table.getOptions());
|
|
|
|
|
|
|
|
boolean isView = genView(paramsObj);
|
|
|
|
List<String> templates = new ArrayList<String>();
|
|
|
|
List<String> templates = new ArrayList<String>();
|
|
|
|
templates.add("vm/java/domain.java.vm");
|
|
|
|
templates.add("vm/java/domain.java.vm");
|
|
|
|
templates.add("vm/java/mapper.java.vm");
|
|
|
|
templates.add("vm/java/mapper.java.vm");
|
|
|
|
@ -146,6 +157,10 @@ public class VelocityUtils
|
|
|
|
templates.add("vm/html/list.html.vm");
|
|
|
|
templates.add("vm/html/list.html.vm");
|
|
|
|
templates.add("vm/java/sub-domain.java.vm");
|
|
|
|
templates.add("vm/java/sub-domain.java.vm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isView)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
templates.add("vm/html/view.html.vm");
|
|
|
|
|
|
|
|
}
|
|
|
|
templates.add("vm/html/add.html.vm");
|
|
|
|
templates.add("vm/html/add.html.vm");
|
|
|
|
templates.add("vm/html/edit.html.vm");
|
|
|
|
templates.add("vm/html/edit.html.vm");
|
|
|
|
templates.add("vm/sql/sql.vm");
|
|
|
|
templates.add("vm/sql/sql.vm");
|
|
|
|
@ -220,6 +235,10 @@ public class VelocityUtils
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileName = StringUtils.format("{}/edit.html", htmlPath);
|
|
|
|
fileName = StringUtils.format("{}/edit.html", htmlPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (template.contains("view.html.vm"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fileName = StringUtils.format("{}/view.html", htmlPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (template.contains("sql.vm"))
|
|
|
|
else if (template.contains("sql.vm"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fileName = businessName + "Menu.sql";
|
|
|
|
fileName = businessName + "Menu.sql";
|
|
|
|
@ -342,6 +361,21 @@ public class VelocityUtils
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 扩展功能/生成详情页
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param paramsObj 生成其他选项
|
|
|
|
|
|
|
|
* @return 是否生成详细页
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static boolean genView(JSONObject paramsObj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (paramsObj.containsKey(GenConstants.GEN_VIEW))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return paramsObj.getBoolean(GenConstants.GEN_VIEW);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取树名称
|
|
|
|
* 获取树名称
|
|
|
|
*
|
|
|
|
*
|
|
|
|
|