|
|
|
@ -1,373 +1,373 @@
|
|
|
|
/* */ package com.archive.project.tool.gen.util
|
|
|
|
package com.archive.project.tool.gen.util
|
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
;
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
/* */ import com.archive.common.utils.DateUtils;
|
|
|
|
import com.archive.common.utils.DateUtils;
|
|
|
|
/* */ import com.archive.common.utils.StringUtils;
|
|
|
|
import com.archive.common.utils.StringUtils;
|
|
|
|
/* */ import com.archive.project.tool.gen.domain.GenTable;
|
|
|
|
import com.archive.project.tool.gen.domain.GenTable;
|
|
|
|
/* */ import com.archive.project.tool.gen.domain.GenTableColumn;
|
|
|
|
import com.archive.project.tool.gen.domain.GenTableColumn;
|
|
|
|
/* */ import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
/* */ import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
/* */ import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
/* */ import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
/* */ import org.apache.velocity.VelocityContext;
|
|
|
|
import org.apache.velocity.VelocityContext;
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public class VelocityUtils
|
|
|
|
public class VelocityUtils
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* */ private static final String PROJECT_PATH = "main/java";
|
|
|
|
private static final String PROJECT_PATH = "main/java";
|
|
|
|
/* */ private static final String MYBATIS_PATH = "main/resources/mybatis";
|
|
|
|
private static final String MYBATIS_PATH = "main/resources/mybatis";
|
|
|
|
/* */ private static final String TEMPLATES_PATH = "main/resources/templates";
|
|
|
|
private static final String TEMPLATES_PATH = "main/resources/templates";
|
|
|
|
/* */ private static final String DEFAULT_PARENT_MENU_ID = "3";
|
|
|
|
private static final String DEFAULT_PARENT_MENU_ID = "3";
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static VelocityContext prepareContext(GenTable genTable) {
|
|
|
|
public static VelocityContext prepareContext(GenTable genTable) {
|
|
|
|
/* 35 */ String moduleName = genTable.getModuleName();
|
|
|
|
String moduleName = genTable.getModuleName();
|
|
|
|
/* 36 */ String businessName = genTable.getBusinessName();
|
|
|
|
String businessName = genTable.getBusinessName();
|
|
|
|
/* 37 */ String packageName = genTable.getPackageName();
|
|
|
|
String packageName = genTable.getPackageName();
|
|
|
|
/* 38 */ String tplCategory = genTable.getTplCategory();
|
|
|
|
String tplCategory = genTable.getTplCategory();
|
|
|
|
/* 39 */ String functionName = genTable.getFunctionName();
|
|
|
|
String functionName = genTable.getFunctionName();
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 41 */ VelocityContext velocityContext = new VelocityContext();
|
|
|
|
VelocityContext velocityContext = new VelocityContext();
|
|
|
|
/* 42 */ velocityContext.put("tplCategory", genTable.getTplCategory());
|
|
|
|
velocityContext.put("tplCategory", genTable.getTplCategory());
|
|
|
|
/* 43 */ velocityContext.put("tableName", genTable.getTableName());
|
|
|
|
velocityContext.put("tableName", genTable.getTableName());
|
|
|
|
/* 44 */ velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
|
|
|
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
|
|
|
/* 45 */ velocityContext.put("ClassName", genTable.getClassName());
|
|
|
|
velocityContext.put("ClassName", genTable.getClassName());
|
|
|
|
/* 46 */ velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
|
|
|
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
|
|
|
/* 47 */ velocityContext.put("moduleName", genTable.getModuleName());
|
|
|
|
velocityContext.put("moduleName", genTable.getModuleName());
|
|
|
|
/* 48 */ velocityContext.put("businessName", genTable.getBusinessName());
|
|
|
|
velocityContext.put("businessName", genTable.getBusinessName());
|
|
|
|
/* 49 */ velocityContext.put("basePackage", getPackagePrefix(packageName));
|
|
|
|
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
|
|
|
/* 50 */ velocityContext.put("packageName", packageName);
|
|
|
|
velocityContext.put("packageName", packageName);
|
|
|
|
/* 51 */ velocityContext.put("author", genTable.getFunctionAuthor());
|
|
|
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
|
|
|
/* 52 */ velocityContext.put("datetime", DateUtils.getDate());
|
|
|
|
velocityContext.put("datetime", DateUtils.getDate());
|
|
|
|
/* 53 */ velocityContext.put("pkColumn", genTable.getPkColumn());
|
|
|
|
velocityContext.put("pkColumn", genTable.getPkColumn());
|
|
|
|
/* 54 */ velocityContext.put("importList", getImportList(genTable));
|
|
|
|
velocityContext.put("importList", getImportList(genTable));
|
|
|
|
/* 55 */ velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
|
|
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
|
|
|
/* 56 */ velocityContext.put("columns", genTable.getColumns());
|
|
|
|
velocityContext.put("columns", genTable.getColumns());
|
|
|
|
/* 57 */ velocityContext.put("table", genTable);
|
|
|
|
velocityContext.put("table", genTable);
|
|
|
|
/* 58 */ setMenuVelocityContext(velocityContext, genTable);
|
|
|
|
setMenuVelocityContext(velocityContext, genTable);
|
|
|
|
/* 59 */ if ("tree".equals(tplCategory))
|
|
|
|
if ("tree".equals(tplCategory))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 61 */ setTreeVelocityContext(velocityContext, genTable);
|
|
|
|
setTreeVelocityContext(velocityContext, genTable);
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 63 */ if ("sub".equals(tplCategory))
|
|
|
|
if ("sub".equals(tplCategory))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 65 */ setSubVelocityContext(velocityContext, genTable);
|
|
|
|
setSubVelocityContext(velocityContext, genTable);
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 67 */ return velocityContext;
|
|
|
|
return velocityContext;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
/* 72 */ String options = genTable.getOptions();
|
|
|
|
String options = genTable.getOptions();
|
|
|
|
/* 73 */ JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
/* 74 */ String parentMenuId = getParentMenuId(paramsObj);
|
|
|
|
String parentMenuId = getParentMenuId(paramsObj);
|
|
|
|
/* 75 */ context.put("parentMenuId", parentMenuId);
|
|
|
|
context.put("parentMenuId", parentMenuId);
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
/* 80 */ String options = genTable.getOptions();
|
|
|
|
String options = genTable.getOptions();
|
|
|
|
/* 81 */ JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
/* 82 */ String treeCode = getTreecode(paramsObj);
|
|
|
|
String treeCode = getTreecode(paramsObj);
|
|
|
|
/* 83 */ String treeParentCode = getTreeParentCode(paramsObj);
|
|
|
|
String treeParentCode = getTreeParentCode(paramsObj);
|
|
|
|
/* 84 */ String treeName = getTreeName(paramsObj);
|
|
|
|
String treeName = getTreeName(paramsObj);
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 86 */ context.put("treeCode", treeCode);
|
|
|
|
context.put("treeCode", treeCode);
|
|
|
|
/* 87 */ context.put("treeParentCode", treeParentCode);
|
|
|
|
context.put("treeParentCode", treeParentCode);
|
|
|
|
/* 88 */ context.put("treeName", treeName);
|
|
|
|
context.put("treeName", treeName);
|
|
|
|
/* 89 */ context.put("expandColumn", Integer.valueOf(getExpandColumn(genTable)));
|
|
|
|
context.put("expandColumn", Integer.valueOf(getExpandColumn(genTable)));
|
|
|
|
/* 90 */ if (paramsObj.containsKey("treeParentCode"))
|
|
|
|
if (paramsObj.containsKey("treeParentCode"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 92 */ context.put("tree_parent_code", paramsObj.getString("treeParentCode"));
|
|
|
|
context.put("tree_parent_code", paramsObj.getString("treeParentCode"));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 94 */ if (paramsObj.containsKey("treeName"))
|
|
|
|
if (paramsObj.containsKey("treeName"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 96 */ context.put("tree_name", paramsObj.getString("treeName"));
|
|
|
|
context.put("tree_name", paramsObj.getString("treeName"));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static void setSubVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
public static void setSubVelocityContext(VelocityContext context, GenTable genTable) {
|
|
|
|
/* 102 */ GenTable subTable = genTable.getSubTable();
|
|
|
|
GenTable subTable = genTable.getSubTable();
|
|
|
|
/* 103 */ String subTableName = genTable.getSubTableName();
|
|
|
|
String subTableName = genTable.getSubTableName();
|
|
|
|
/* 104 */ String subTableFkName = genTable.getSubTableFkName();
|
|
|
|
String subTableFkName = genTable.getSubTableFkName();
|
|
|
|
/* 105 */ String subClassName = genTable.getSubTable().getClassName();
|
|
|
|
String subClassName = genTable.getSubTable().getClassName();
|
|
|
|
/* 106 */ String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
|
|
|
|
String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 108 */ context.put("subTable", subTable);
|
|
|
|
context.put("subTable", subTable);
|
|
|
|
/* 109 */ context.put("subTableName", subTableName);
|
|
|
|
context.put("subTableName", subTableName);
|
|
|
|
/* 110 */ context.put("subTableFkName", subTableFkName);
|
|
|
|
context.put("subTableFkName", subTableFkName);
|
|
|
|
/* 111 */ context.put("subTableFkClassName", subTableFkClassName);
|
|
|
|
context.put("subTableFkClassName", subTableFkClassName);
|
|
|
|
/* 112 */ context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName));
|
|
|
|
context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName));
|
|
|
|
/* 113 */ context.put("subClassName", subClassName);
|
|
|
|
context.put("subClassName", subClassName);
|
|
|
|
/* 114 */ context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
|
|
|
context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
|
|
|
/* 115 */ context.put("subImportList", getImportList(genTable.getSubTable()));
|
|
|
|
context.put("subImportList", getImportList(genTable.getSubTable()));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static List<String> getTemplateList(String tplCategory) {
|
|
|
|
public static List<String> getTemplateList(String tplCategory) {
|
|
|
|
/* 125 */ List<String> templates = new ArrayList<>();
|
|
|
|
List<String> templates = new ArrayList<>();
|
|
|
|
/* 126 */ templates.add("vm/java/domain.java.vm");
|
|
|
|
templates.add("vm/java/domain.java.vm");
|
|
|
|
/* 127 */ templates.add("vm/java/mapper.java.vm");
|
|
|
|
templates.add("vm/java/mapper.java.vm");
|
|
|
|
/* 128 */ templates.add("vm/java/service.java.vm");
|
|
|
|
templates.add("vm/java/service.java.vm");
|
|
|
|
/* 129 */ templates.add("vm/java/serviceImpl.java.vm");
|
|
|
|
templates.add("vm/java/serviceImpl.java.vm");
|
|
|
|
/* 130 */ templates.add("vm/java/controller.java.vm");
|
|
|
|
templates.add("vm/java/controller.java.vm");
|
|
|
|
/* 131 */ templates.add("vm/xml/mapper.xml.vm");
|
|
|
|
templates.add("vm/xml/mapper.xml.vm");
|
|
|
|
/* 132 */ if ("crud".equals(tplCategory)) {
|
|
|
|
if ("crud".equals(tplCategory)) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 134 */ templates.add("vm/html/list.html.vm");
|
|
|
|
templates.add("vm/html/list.html.vm");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 136 */ else if ("tree".equals(tplCategory)) {
|
|
|
|
else if ("tree".equals(tplCategory)) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 138 */ templates.add("vm/html/tree.html.vm");
|
|
|
|
templates.add("vm/html/tree.html.vm");
|
|
|
|
/* 139 */ templates.add("vm/html/list-tree.html.vm");
|
|
|
|
templates.add("vm/html/list-tree.html.vm");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 141 */ else if ("sub".equals(tplCategory)) {
|
|
|
|
else if ("sub".equals(tplCategory)) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 143 */ templates.add("vm/html/list.html.vm");
|
|
|
|
templates.add("vm/html/list.html.vm");
|
|
|
|
/* 144 */ templates.add("vm/java/sub-domain.java.vm");
|
|
|
|
templates.add("vm/java/sub-domain.java.vm");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 146 */ templates.add("vm/html/add.html.vm");
|
|
|
|
templates.add("vm/html/add.html.vm");
|
|
|
|
/* 147 */ templates.add("vm/html/edit.html.vm");
|
|
|
|
templates.add("vm/html/edit.html.vm");
|
|
|
|
/* 148 */ templates.add("vm/sql/sql.vm");
|
|
|
|
templates.add("vm/sql/sql.vm");
|
|
|
|
/* 149 */ return templates;
|
|
|
|
return templates;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getFileName(String template, GenTable genTable) {
|
|
|
|
public static String getFileName(String template, GenTable genTable) {
|
|
|
|
/* 158 */ String fileName = "";
|
|
|
|
String fileName = "";
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 160 */ String packageName = genTable.getPackageName();
|
|
|
|
String packageName = genTable.getPackageName();
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 162 */ String moduleName = genTable.getModuleName();
|
|
|
|
String moduleName = genTable.getModuleName();
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 164 */ String className = genTable.getClassName();
|
|
|
|
String className = genTable.getClassName();
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 166 */ String businessName = genTable.getBusinessName();
|
|
|
|
String businessName = genTable.getBusinessName();
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 168 */ String javaPath = "main/java/" + StringUtils.replace(packageName, ".", "/");
|
|
|
|
String javaPath = "main/java/" + StringUtils.replace(packageName, ".", "/");
|
|
|
|
/* 169 */ String mybatisPath = "main/resources/mybatis/" + moduleName;
|
|
|
|
String mybatisPath = "main/resources/mybatis/" + moduleName;
|
|
|
|
/* 170 */ String htmlPath = "main/resources/templates/" + moduleName + "/" + businessName;
|
|
|
|
String htmlPath = "main/resources/templates/" + moduleName + "/" + businessName;
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 172 */ if (template.contains("domain.java.vm"))
|
|
|
|
if (template.contains("domain.java.vm"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 174 */ fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, className });
|
|
|
|
fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 176 */ if (template.contains("sub-domain.java.vm") && StringUtils.equals("sub", genTable.getTplCategory())) {
|
|
|
|
if (template.contains("sub-domain.java.vm") && StringUtils.equals("sub", genTable.getTplCategory())) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 178 */ fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, genTable.getSubTable().getClassName() });
|
|
|
|
fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, genTable.getSubTable().getClassName() });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 180 */ else if (template.contains("mapper.java.vm")) {
|
|
|
|
else if (template.contains("mapper.java.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 182 */ fileName = StringUtils.format("{}/{}/mapper/{}Mapper.java", new Object[] { javaPath, businessName, className });
|
|
|
|
fileName = StringUtils.format("{}/{}/mapper/{}Mapper.java", new Object[] { javaPath, businessName, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 184 */ else if (template.contains("service.java.vm")) {
|
|
|
|
else if (template.contains("service.java.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 186 */ fileName = StringUtils.format("{}/{}/service/I{}Service.java", new Object[] { javaPath, businessName, className });
|
|
|
|
fileName = StringUtils.format("{}/{}/service/I{}Service.java", new Object[] { javaPath, businessName, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 188 */ else if (template.contains("serviceImpl.java.vm")) {
|
|
|
|
else if (template.contains("serviceImpl.java.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 190 */ fileName = StringUtils.format("{}/{}/service/impl/{}ServiceImpl.java", new Object[] { javaPath, businessName, className });
|
|
|
|
fileName = StringUtils.format("{}/{}/service/impl/{}ServiceImpl.java", new Object[] { javaPath, businessName, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 192 */ else if (template.contains("controller.java.vm")) {
|
|
|
|
else if (template.contains("controller.java.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 194 */ fileName = StringUtils.format("{}/{}/controller/{}Controller.java", new Object[] { javaPath, businessName, className });
|
|
|
|
fileName = StringUtils.format("{}/{}/controller/{}Controller.java", new Object[] { javaPath, businessName, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 196 */ else if (template.contains("mapper.xml.vm")) {
|
|
|
|
else if (template.contains("mapper.xml.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 198 */ fileName = StringUtils.format("{}/{}Mapper.xml", new Object[] { mybatisPath, className });
|
|
|
|
fileName = StringUtils.format("{}/{}Mapper.xml", new Object[] { mybatisPath, className });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 200 */ else if (template.contains("list.html.vm")) {
|
|
|
|
else if (template.contains("list.html.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 202 */ fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName });
|
|
|
|
fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 204 */ else if (template.contains("list-tree.html.vm")) {
|
|
|
|
else if (template.contains("list-tree.html.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 206 */ fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName });
|
|
|
|
fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 208 */ else if (template.contains("tree.html.vm")) {
|
|
|
|
else if (template.contains("tree.html.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 210 */ fileName = StringUtils.format("{}/tree.html", new Object[] { htmlPath });
|
|
|
|
fileName = StringUtils.format("{}/tree.html", new Object[] { htmlPath });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 212 */ else if (template.contains("add.html.vm")) {
|
|
|
|
else if (template.contains("add.html.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 214 */ fileName = StringUtils.format("{}/add.html", new Object[] { htmlPath });
|
|
|
|
fileName = StringUtils.format("{}/add.html", new Object[] { htmlPath });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 216 */ else if (template.contains("edit.html.vm")) {
|
|
|
|
else if (template.contains("edit.html.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 218 */ fileName = StringUtils.format("{}/edit.html", new Object[] { htmlPath });
|
|
|
|
fileName = StringUtils.format("{}/edit.html", new Object[] { htmlPath });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 220 */ else if (template.contains("sql.vm")) {
|
|
|
|
else if (template.contains("sql.vm")) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 222 */ fileName = businessName + "Menu.sql";
|
|
|
|
fileName = businessName + "Menu.sql";
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 224 */ return fileName;
|
|
|
|
return fileName;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getPackagePrefix(String packageName) {
|
|
|
|
public static String getPackagePrefix(String packageName) {
|
|
|
|
/* 235 */ int lastIndex = packageName.lastIndexOf(".");
|
|
|
|
int lastIndex = packageName.lastIndexOf(".");
|
|
|
|
/* 236 */ String basePackage = StringUtils.substring(packageName, 0, lastIndex);
|
|
|
|
String basePackage = StringUtils.substring(packageName, 0, lastIndex);
|
|
|
|
/* 237 */ return basePackage;
|
|
|
|
return basePackage;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static HashSet<String> getImportList(GenTable genTable) {
|
|
|
|
public static HashSet<String> getImportList(GenTable genTable) {
|
|
|
|
/* 248 */ List<GenTableColumn> columns = genTable.getColumns();
|
|
|
|
List<GenTableColumn> columns = genTable.getColumns();
|
|
|
|
/* 249 */ GenTable subGenTable = genTable.getSubTable();
|
|
|
|
GenTable subGenTable = genTable.getSubTable();
|
|
|
|
/* 250 */ HashSet<String> importList = new HashSet<>();
|
|
|
|
HashSet<String> importList = new HashSet<>();
|
|
|
|
/* 251 */ if (StringUtils.isNotNull(subGenTable))
|
|
|
|
if (StringUtils.isNotNull(subGenTable))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 253 */ importList.add("java.util.List");
|
|
|
|
importList.add("java.util.List");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 255 */ for (GenTableColumn column : columns) {
|
|
|
|
for (GenTableColumn column : columns) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 257 */ if (!column.isSuperColumn() && "Date".equals(column.getJavaType())) {
|
|
|
|
if (!column.isSuperColumn() && "Date".equals(column.getJavaType())) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 259 */ importList.add("java.util.Date");
|
|
|
|
importList.add("java.util.Date");
|
|
|
|
/* 260 */ importList.add("com.fasterxml.jackson.annotation.JsonFormat"); continue;
|
|
|
|
importList.add("com.fasterxml.jackson.annotation.JsonFormat"); continue;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 262 */ if (!column.isSuperColumn() && "BigDecimal".equals(column.getJavaType()))
|
|
|
|
if (!column.isSuperColumn() && "BigDecimal".equals(column.getJavaType()))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 264 */ importList.add("java.math.BigDecimal");
|
|
|
|
importList.add("java.math.BigDecimal");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 267 */ return importList;
|
|
|
|
return importList;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getPermissionPrefix(String moduleName, String businessName) {
|
|
|
|
public static String getPermissionPrefix(String moduleName, String businessName) {
|
|
|
|
/* 279 */ return StringUtils.format("{}:{}", new Object[] { moduleName, businessName });
|
|
|
|
return StringUtils.format("{}:{}", new Object[] { moduleName, businessName });
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getParentMenuId(JSONObject paramsObj) {
|
|
|
|
public static String getParentMenuId(JSONObject paramsObj) {
|
|
|
|
/* 290 */ if (StringUtils.isNotEmpty((Map)paramsObj) && paramsObj.containsKey("parentMenuId"))
|
|
|
|
if (StringUtils.isNotEmpty((Map)paramsObj) && paramsObj.containsKey("parentMenuId"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 292 */ return paramsObj.getString("parentMenuId");
|
|
|
|
return paramsObj.getString("parentMenuId");
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 294 */ return "3";
|
|
|
|
return "3";
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getTreecode(JSONObject paramsObj) {
|
|
|
|
public static String getTreecode(JSONObject paramsObj) {
|
|
|
|
/* 305 */ if (paramsObj.containsKey("treeCode"))
|
|
|
|
if (paramsObj.containsKey("treeCode"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 307 */ return StringUtils.toCamelCase(paramsObj.getString("treeCode"));
|
|
|
|
return StringUtils.toCamelCase(paramsObj.getString("treeCode"));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 309 */ return "";
|
|
|
|
return "";
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getTreeParentCode(JSONObject paramsObj) {
|
|
|
|
public static String getTreeParentCode(JSONObject paramsObj) {
|
|
|
|
/* 320 */ if (paramsObj.containsKey("treeParentCode"))
|
|
|
|
if (paramsObj.containsKey("treeParentCode"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 322 */ return StringUtils.toCamelCase(paramsObj.getString("treeParentCode"));
|
|
|
|
return StringUtils.toCamelCase(paramsObj.getString("treeParentCode"));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 324 */ return "";
|
|
|
|
return "";
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static String getTreeName(JSONObject paramsObj) {
|
|
|
|
public static String getTreeName(JSONObject paramsObj) {
|
|
|
|
/* 335 */ if (paramsObj.containsKey("treeName"))
|
|
|
|
if (paramsObj.containsKey("treeName"))
|
|
|
|
/* */ {
|
|
|
|
{
|
|
|
|
/* 337 */ return StringUtils.toCamelCase(paramsObj.getString("treeName"));
|
|
|
|
return StringUtils.toCamelCase(paramsObj.getString("treeName"));
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* 339 */ return "";
|
|
|
|
return "";
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* */ public static int getExpandColumn(GenTable genTable) {
|
|
|
|
public static int getExpandColumn(GenTable genTable) {
|
|
|
|
/* 350 */ String options = genTable.getOptions();
|
|
|
|
String options = genTable.getOptions();
|
|
|
|
/* 351 */ JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
|
|
|
/* 352 */ String treeName = paramsObj.getString("treeName");
|
|
|
|
String treeName = paramsObj.getString("treeName");
|
|
|
|
/* 353 */ int num = 0;
|
|
|
|
int num = 0;
|
|
|
|
/* 354 */ for (GenTableColumn column : genTable.getColumns()) {
|
|
|
|
for (GenTableColumn column : genTable.getColumns()) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 356 */ if (column.isList()) {
|
|
|
|
if (column.isList()) {
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 358 */ num++;
|
|
|
|
num++;
|
|
|
|
/* 359 */ String columnName = column.getColumnName();
|
|
|
|
String columnName = column.getColumnName();
|
|
|
|
/* 360 */ if (columnName.equals(treeName)) {
|
|
|
|
if (columnName.equals(treeName)) {
|
|
|
|
/* */ break;
|
|
|
|
break;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 366 */ return num;
|
|
|
|
return num;
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
/* */ }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\ge\\util\VelocityUtils.class
|
|
|
|
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\ge\\util\VelocityUtils.class
|
|
|
|
|